path = $path; $this->filename = $filename; $this->contentType = $contentType; } /** * @return \Swift_Mime_Attachment the attachment as a swift attachment */ public function As_Swift_Attachment() { $swa = \Swift_Attachment::fromPath($this->path); if($this->filename !== '') { $swa->setFilename($this->filename); } if($this->contentType !== '') { $swa->setContentType($this->contentType); } return $swa; } }