/** * Adds the given file to the hash pool. The hash will be calculated over the total hash pool. * @param \System\IO\File The file to include in the hashing */ public final function addFile(\System\IO\File $file) { if ($this->hash) { if ($file->exists()) { hash_update_file($this->hash, $file->getFullPath()); } else { throw new \System\Error\Exception\FileNotFoundException('The given file does not exists: ' . $file->getFilename()); } } else { throw new \System\Error\Exception\InvalidMethodException('This method is called after finalizing the hash'); } }
/** * Adds an attachment to the Email message. * @param \System\IO\File The file object to attach */ public final function addAttachment(\System\IO\File $file) { if ($file->exists()) { $this->attachments[] = $file; } else { throw new \System\Error\Exception\FileNotFoundException('The given email attachment file ' . $file->getFilename() . ' does not exists'); } }