Remove static method in ServeFileResponseFactory

This commit is contained in:
Benoît Burnichon
2016-01-14 10:58:18 +01:00
parent bba360c3a1
commit c5b57395fd
3 changed files with 3 additions and 22 deletions

View File

@@ -14,12 +14,11 @@ namespace Alchemy\Phrasea\Core\Provider;
use Alchemy\Phrasea\Core\Event\Subscriber\XSendFileSubscriber;
use Alchemy\Phrasea\Http\H264PseudoStreaming\H264Factory;
use Alchemy\Phrasea\Http\ServeFileResponseFactory;
use Alchemy\Phrasea\Http\StaticFile\StaticFileFactory;
use Alchemy\Phrasea\Http\StaticFile\StaticMode;
use Alchemy\Phrasea\Http\StaticFile\Symlink\SymLinker;
use Alchemy\Phrasea\Http\XSendFile\XSendFileFactory;
use Silex\Application;
use Silex\ServiceProviderInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class FileServeServiceProvider implements ServiceProviderInterface
{
@@ -45,7 +44,7 @@ class FileServeServiceProvider implements ServiceProviderInterface
});
$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)
{
$app['dispatcher'] = $app->share(
$app->extend('dispatcher', function ($dispatcher, Application $app) {
$app->extend('dispatcher', function (EventDispatcherInterface $dispatcher, Application $app) {
$dispatcher->addSubscriber(new XSendFileSubscriber($app));
return $dispatcher;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Http;
use Alchemy\Phrasea\Application;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
@@ -24,17 +23,6 @@ class ServeFileResponseFactory implements DeliverDataInterface
$this->unicode = $unicode;
}
/**
* @param Application $app
* @return self
*/
public static function create(Application $app)
{
return new self(
$app['unicode']
);
}
/**
* {@inheritdoc}
*/

View File

@@ -16,12 +16,6 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase
{
protected $factory;
public function testDeliverFileFactoryCreation()
{
$factory = ServeFileResponseFactory::create(self::$DI['app']);
$this->assertInstanceOf('Alchemy\Phrasea\Http\ServeFileResponseFactory', $factory);
}
public function testDeliverFile()
{
$this->factory = new ServeFileResponseFactory(new \unicode());