mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 02:13:15 +00:00
Remove static method in ServeFileResponseFactory
This commit is contained in:
@@ -14,12 +14,11 @@ namespace Alchemy\Phrasea\Core\Provider;
|
|||||||
use Alchemy\Phrasea\Core\Event\Subscriber\XSendFileSubscriber;
|
use Alchemy\Phrasea\Core\Event\Subscriber\XSendFileSubscriber;
|
||||||
use Alchemy\Phrasea\Http\H264PseudoStreaming\H264Factory;
|
use Alchemy\Phrasea\Http\H264PseudoStreaming\H264Factory;
|
||||||
use Alchemy\Phrasea\Http\ServeFileResponseFactory;
|
use Alchemy\Phrasea\Http\ServeFileResponseFactory;
|
||||||
use Alchemy\Phrasea\Http\StaticFile\StaticFileFactory;
|
|
||||||
use Alchemy\Phrasea\Http\StaticFile\StaticMode;
|
use Alchemy\Phrasea\Http\StaticFile\StaticMode;
|
||||||
use Alchemy\Phrasea\Http\StaticFile\Symlink\SymLinker;
|
|
||||||
use Alchemy\Phrasea\Http\XSendFile\XSendFileFactory;
|
use Alchemy\Phrasea\Http\XSendFile\XSendFileFactory;
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Silex\ServiceProviderInterface;
|
use Silex\ServiceProviderInterface;
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
|
||||||
class FileServeServiceProvider implements ServiceProviderInterface
|
class FileServeServiceProvider implements ServiceProviderInterface
|
||||||
{
|
{
|
||||||
@@ -45,7 +44,7 @@ class FileServeServiceProvider implements ServiceProviderInterface
|
|||||||
});
|
});
|
||||||
|
|
||||||
$app['phraseanet.file-serve'] = $app->share(function (Application $app) {
|
$app['phraseanet.file-serve'] = $app->share(function (Application $app) {
|
||||||
return ServeFileResponseFactory::create($app);
|
return new ServeFileResponseFactory($app['unicode']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +54,7 @@ class FileServeServiceProvider implements ServiceProviderInterface
|
|||||||
public function boot(Application $app)
|
public function boot(Application $app)
|
||||||
{
|
{
|
||||||
$app['dispatcher'] = $app->share(
|
$app['dispatcher'] = $app->share(
|
||||||
$app->extend('dispatcher', function ($dispatcher, Application $app) {
|
$app->extend('dispatcher', function (EventDispatcherInterface $dispatcher, Application $app) {
|
||||||
$dispatcher->addSubscriber(new XSendFileSubscriber($app));
|
$dispatcher->addSubscriber(new XSendFileSubscriber($app));
|
||||||
|
|
||||||
return $dispatcher;
|
return $dispatcher;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Alchemy\Phrasea\Http;
|
namespace Alchemy\Phrasea\Http;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Application;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||||
|
|
||||||
@@ -24,17 +23,6 @@ class ServeFileResponseFactory implements DeliverDataInterface
|
|||||||
$this->unicode = $unicode;
|
$this->unicode = $unicode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Application $app
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public static function create(Application $app)
|
|
||||||
{
|
|
||||||
return new self(
|
|
||||||
$app['unicode']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,12 +16,6 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase
|
|||||||
{
|
{
|
||||||
protected $factory;
|
protected $factory;
|
||||||
|
|
||||||
public function testDeliverFileFactoryCreation()
|
|
||||||
{
|
|
||||||
$factory = ServeFileResponseFactory::create(self::$DI['app']);
|
|
||||||
$this->assertInstanceOf('Alchemy\Phrasea\Http\ServeFileResponseFactory', $factory);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testDeliverFile()
|
public function testDeliverFile()
|
||||||
{
|
{
|
||||||
$this->factory = new ServeFileResponseFactory(new \unicode());
|
$this->factory = new ServeFileResponseFactory(new \unicode());
|
||||||
|
|||||||
Reference in New Issue
Block a user