path = $path; return $this; } /** * Get path * * If none is set, uses value from sys_get_temp_dir() * * @return string */ public function getPath() { if (null === $this->path) { $this->setPath(sys_get_temp_dir()); } return $this->path; } /** * Set callback used to generate a file name * * @param callable $callback * @throws \Zend\Mail\Exception\InvalidArgumentException * @return FileOptions */ public function setCallback($callback) { if (!is_callable($callback)) { throw new Exception\InvalidArgumentException(sprintf( '%s expects a valid callback; received "%s"', __METHOD__, (is_object($callback) ? get_class($callback) : gettype($callback)) )); } $this->callback = $callback; return $this; } /** * Get callback used to generate a file name * * @return callable */ public function getCallback() { if (null === $this->callback) { $this->setCallback(function ($transport) { return 'ZendMail_' . time() . '_' . mt_rand() . '.tmp'; }); } return $this->callback; } }