Ejemplo n.º 1
0
 public function __construct(FileObject $file, $name = null)
 {
     if (($file->exists() and $contents = $file->getContents()) === false or empty($contents)) {
         throw new InvalidArgumentException('EMA-006: The file does not exists, not readable or empty.');
     }
     if ($name === null) {
         $name = pathinfo($file->getPath(), PATHINFO_BASENAME);
     }
     $this->file = $file;
     parent::__construct($name, $contents, $file->getMime());
 }
Ejemplo n.º 2
0
 /**
  * Adds an attachment
  *
  * @param Attachment $attachment
  *
  * @return this
  *
  * @since 2.0
  */
 public function attach(Attachment $attachment)
 {
     $this->attachments[] = $attachment;
     if ($attachment->isInline()) {
         $this->hasInline = true;
     }
     return $this;
 }