Pop\Mail\Attachment::__construct PHP Метод

__construct() публичный Метод

Instantiate the mail attachment object.
public __construct ( string $file ) : Attachment
$file string
Результат Attachment
    public function __construct($file)
    {
        // Determine if the file is valid.
        if (!file_exists($file)) {
            throw new Exception('Error: The file does not exist.');
        }
        $fileParts = pathinfo($file);
        $fileContents = file_get_contents($file);
        // Encode the file contents and set the file into the attachments array property.
        $encoded = chunk_split(base64_encode($fileContents));
        $this->basename = $fileParts['basename'];
        $this->encoded = $encoded;
    }