public static function attachment($path_or_data = null, $filename = null, $contentType = null) {
        $from_path = realpath($path_or_data);
        if ($from_path) {
            $attachment = Swift_Attachment::fromPath($path_or_data, $contentType);
            $attachment->setFilename($filename);
        } else {
            $attachment = Swift_Attachment::newInstance($path_or_data, $filename, $contentType);
        }
        return $attachment;
    }
public static function attachment($path_or_data = null, $filename = null, $contentType = null) {
        $from_path = realpath($path_or_data);
        if ($from_path) {
            $attachment = Swift_Attachment::fromPath($path_or_data, $contentType);
            $attachment->setFilename($filename);
        } else {
            $attachment = Swift_Attachment::newInstance($path_or_data, $filename, $contentType);
        }
        return $attachment;
    }
public static function attachment ( $ path_or_data = null , $ filename = null , $ contentType = null ) { $ from_path = realpath ( $ path_or_data ) ; if ( $ from_path ) { $ attachment = Swift_Attachment :: fromPath ( $ path_or_data , $ contentType ) ; $ attachment -> setFilename ( $ filename ) ; } else { $ attachment = Swift_Attachment :: newInstance ( $ path_or_data , $ filename , $ contentType ) ; } return $ attachment ; }
Create a new Attachment.

@param string|Swift_OutputByteStream $path_or_data   path or data to be attached
@param string                        $filename
@param string                        $contentType

@return Swift_Mime_Attachment
Create a new Attachment .