/** * Constructor * * @param string $data File data * @param string $name Name of attachment (filename) * @param string $contentType Content type of file * @param string $encoding What encoding to use */ public function __construct($data, $name = '', $contentType = 'application/octet-stream', $encoding = null) { $encoding = is_null($encoding) ? new Base64Encoding() : $encoding; parent::__construct($data, $name, $contentType, $encoding); }
/** * Constructor * * @param string $infilename Name of input file * @param string $outfilename Name of file to use as attachment * @param string $contentType Content type of file * @param string $encoding What encoding to use */ public function __construct($infilename, $outfilename, $contentType = 'application/octet-stream', $encoding = null) { $encoding = is_null($encoding) ? new Base64Encoding() : $encoding; parent::__construct(file_get_contents($infilename), $outfilename, $contentType, $encoding); }