Commit 5efdf830 authored by Henrik Bjørnskov's avatar Henrik Bjørnskov Committed by Fabien Potencier

Change closures to use as the first parameter.

parent b028c59d
......@@ -62,45 +62,44 @@ class Application extends Container implements HttpKernelInterface, TerminableIn
{
parent::__construct();
$app = $this;
$this['routes_factory'] = $this->factory(function () {
return new RouteCollection();
});
$this['routes'] = function () use ($app) {
$this['routes'] = function ($app) {
return $app['routes_factory'];
};
$this['controllers'] = function () use ($app) {
$this['controllers'] = function ($app) {
return $app['controllers_factory'];
};
$this['controllers_factory'] = $this->factory(function () use ($app) {
$this['controllers_factory'] = $this->factory(function ($app) {
return new ControllerCollection($app['route_factory'], $app['routes_factory']);
});
$this['route_class'] = 'Silex\\Route';
$this['route_factory'] = $this->factory(function () use ($app) {
$this['route_factory'] = $this->factory(function ($app) {
return new $app['route_class']();
});
$this['exception_handler'] = function () use ($app) {
$this['exception_handler'] = function ($app) {
return new ExceptionHandler($app['debug']);
};
$this['callback_resolver'] = function () use ($app) {
$this['callback_resolver'] = function ($app) {
return new CallbackResolver($app);
};
$this['resolver'] = function () use ($app) {
$this['resolver'] = function ($app) {
return new ControllerResolver($app, $app['logger']);
};
$this['kernel'] = function () use ($app) {
$this['kernel'] = function ($app) {
return new HttpKernel($app['dispatcher'], $app['resolver'], $app['request_stack']);
};
$this['request_stack'] = function () use ($app) {
$this['request_stack'] = function () {
return new RequestStack();
};
......
......@@ -34,11 +34,11 @@ class RoutingServiceProvider implements ServiceProviderInterface, EventListenerP
return new UrlGenerator($app['routes'], $app['request_context']);
};
$app['request_matcher'] = function () use ($app) {
$app['request_matcher'] = function ($app) {
return new RedirectableUrlMatcher($app['routes'], $app['request_context']);
};
$app['request_context'] = function () use ($app) {
$app['request_context'] = function ($app) {
$context = new RequestContext();
$context->setHttpPort(isset($app['request.http_port']) ? $app['request.http_port'] : 80);
......@@ -47,7 +47,7 @@ class RoutingServiceProvider implements ServiceProviderInterface, EventListenerP
return $context;
};
$app['routing.listener'] = function () use ($app) {
$app['routing.listener'] = function ($app) {
$urlMatcher = new LazyRequestMatcher(function () use ($app) {
return $app['request_matcher'];
});
......
......@@ -35,7 +35,7 @@ class SerializerServiceProvider implements ServiceProviderInterface
*/
public function register(Container $app)
{
$app['serializer'] = function () use ($app) {
$app['serializer'] = function ($app) {
return new Serializer($app['serializer.normalizers'], $app['serializer.encoders']);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment