register(new SetupMiddlewareProvider()); $app->loadPlugins(); $app['exception_handler'] = $app->share(function ($app) { return new PhraseaExceptionHandlerSubscriber($app['phraseanet.exception_handler']); }); $app['monolog'] = $app->share($app->extend('monolog', function (Logger $monolog) { $monolog->pushProcessor(new WebProcessor()); return $monolog; })); $app->before($app['setup.validate-config'], Application::EARLY_EVENT); $app->bindRoutes(); $app['dispatcher'] = $app->share( $app->extend('dispatcher', function (EventDispatcherInterface $dispatcher, Application $app) { $dispatcher->addSubscriber(new BridgeExceptionSubscriber($app)); $dispatcher->addSubscriber(new FirewallSubscriber()); $dispatcher->addSubscriber(new JsonRequestSubscriber()); if ($app->isDebug()){ $dispatcher->addSubscriber(new DebuggerSubscriber($app)); } return $dispatcher; }) ); return $app; } }