deliverer = $locator; return $this; } /** * @return DeliverDataInterface */ public function getDeliverer() { if ($this->deliverer instanceof DeliverDataInterface) { return $this->deliverer; } if (null === $this->deliverer) { throw new \LogicException('DeliverDataInterface locator was not set'); } $instance = call_user_func($this->deliverer); if (!$instance instanceof DeliverDataInterface) { throw new \LogicException(sprintf( 'Expects locator to return instance of "%s", got "%s"', DeliverDataInterface::class, is_object($instance) ? get_class($instance) : gettype($instance) )); } $this->deliverer = $instance; return $this->deliverer; } /** * Returns a HTTP Response ready to deliver a binary file * * @param string $file * @param string $filename * @param string $disposition * @param string|null $mimeType * @param integer $cacheDuration * @return Response */ public function deliverFile($file, $filename = null, $disposition = DeliverDataInterface::DISPOSITION_INLINE, $mimeType = null, $cacheDuration = null) { return $this->getDeliverer()->deliverFile($file, $filename, $disposition, $mimeType, $cacheDuration); } }