public static function buildSwift($attachmentPath, $name)
    {
        $file = \Swift_Attachment::fromPath($attachmentPath);
        if (is_string($name)) {
            $file->setFilename($name);
        }

        return $file;
    }
public static function buildSwift($attachmentPath, $name)
    {
        $file = \Swift_Attachment::fromPath($attachmentPath);
        if (is_string($name)) {
            $file->setFilename($name);
        }

        return $file;
    }
public static function buildSwift ( $ attachmentPath , $ name ) { $ file = \ Swift_Attachment :: fromPath ( $ attachmentPath ) ; if ( is_string ( $ name ) ) { $ file -> setFilename ( $ name ) ; } return $ file ; }
Builds a Swift_Attachment object with management of filename.

@param string $attachmentPath
@param string|int $name If integer, will be ignored.
@return \Swift_Attachment
Builds a Swift_Attachment object with management of filename .