This commit is contained in:
Benoît Burnichon
2016-01-19 15:30:11 +01:00
parent bbcdb5ff31
commit 6fb295b6b9
3 changed files with 14 additions and 14 deletions

View File

@@ -10,6 +10,7 @@
namespace Alchemy\Phrasea\Application\Helper; namespace Alchemy\Phrasea\Application\Helper;
use Alchemy\Phrasea\Http\DeliverDataInterface; use Alchemy\Phrasea\Http\DeliverDataInterface;
use Symfony\Component\HttpFoundation\Response;
trait DelivererAware trait DelivererAware
{ {
@@ -57,11 +58,12 @@ trait DelivererAware
/** /**
* Returns a HTTP Response ready to deliver a binary file * Returns a HTTP Response ready to deliver a binary file
* *
* @param string $file * @param string $file
* @param string $filename * @param string $filename
* @param string $disposition * @param string $disposition
* @param string|null $mimeType * @param string|null $mimeType
* @param integer $cacheDuration * @param integer $cacheDuration
* @return Response
*/ */
public function deliverFile($file, $filename = null, $disposition = DeliverDataInterface::DISPOSITION_INLINE, $mimeType = null, $cacheDuration = null) public function deliverFile($file, $filename = null, $disposition = DeliverDataInterface::DISPOSITION_INLINE, $mimeType = null, $cacheDuration = null)
{ {
@@ -71,11 +73,12 @@ trait DelivererAware
/** /**
* Return a HTTP Response ready to deliver data * Return a HTTP Response ready to deliver data
* *
* @param string $data * @param string $data
* @param string $filename * @param string $filename
* @param string $mimeType * @param string $mimeType
* @param string $disposition * @param string $disposition
* @param integer $cacheDuration * @param integer $cacheDuration
* @return Response
*/ */
public function deliverData($data, $filename, $mimeType, $disposition = DeliverDataInterface::DISPOSITION_INLINE, $cacheDuration = null) public function deliverData($data, $filename, $mimeType, $disposition = DeliverDataInterface::DISPOSITION_INLINE, $cacheDuration = null)
{ {

View File

@@ -11,6 +11,7 @@
namespace Alchemy\Phrasea\Http; namespace Alchemy\Phrasea\Http;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag; use Symfony\Component\HttpFoundation\ResponseHeaderBag;
interface DeliverDataInterface interface DeliverDataInterface
@@ -26,6 +27,7 @@ interface DeliverDataInterface
* @param string $disposition * @param string $disposition
* @param string|null $mimeType * @param string|null $mimeType
* @param integer $cacheDuration * @param integer $cacheDuration
* @return Response
*/ */
public function deliverFile($file, $filename = null, $disposition = self::DISPOSITION_INLINE, $mimeType = null, $cacheDuration = null); public function deliverFile($file, $filename = null, $disposition = self::DISPOSITION_INLINE, $mimeType = null, $cacheDuration = null);
@@ -37,6 +39,7 @@ interface DeliverDataInterface
* @param string $mimeType * @param string $mimeType
* @param string $disposition * @param string $disposition
* @param integer $cacheDuration * @param integer $cacheDuration
* @return Response
*/ */
public function deliverData($data, $filename, $mimeType, $disposition = self::DISPOSITION_INLINE, $cacheDuration = null); public function deliverData($data, $filename, $mimeType, $disposition = self::DISPOSITION_INLINE, $cacheDuration = null);
} }

View File

@@ -23,9 +23,6 @@ class ServeFileResponseFactory implements DeliverDataInterface
$this->unicode = $unicode; $this->unicode = $unicode;
} }
/**
* {@inheritdoc}
*/
public function deliverFile($file, $filename = '', $disposition = self::DISPOSITION_INLINE, $mimeType = null, $cacheDuration = null) public function deliverFile($file, $filename = '', $disposition = self::DISPOSITION_INLINE, $mimeType = null, $cacheDuration = null)
{ {
$response = new BinaryFileResponse($file); $response = new BinaryFileResponse($file);
@@ -41,9 +38,6 @@ class ServeFileResponseFactory implements DeliverDataInterface
return $response; return $response;
} }
/**
* {@inheritdoc}
*/
public function deliverData($data, $filename, $mimeType, $disposition = self::DISPOSITION_INLINE, $cacheDuration = null) public function deliverData($data, $filename, $mimeType, $disposition = self::DISPOSITION_INLINE, $cacheDuration = null)
{ {
$response = new Response($data); $response = new Response($data);