@@ -17,26 +17,26 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | public function register(Container $app) |
| 19 | 19 | { |
| 20 | - $app['session'] = function ($app) { |
|
| 20 | + $app['session'] = function($app) { |
|
| 21 | 21 | return new Session($app['session.storage']); |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | - $app['session.storage'] = function ($app) { |
|
| 24 | + $app['session.storage'] = function($app) { |
|
| 25 | 25 | return $app['session.storage.native']; |
| 26 | 26 | }; |
| 27 | 27 | |
| 28 | - $app['session.storage.handler'] = function ($app) { |
|
| 28 | + $app['session.storage.handler'] = function($app) { |
|
| 29 | 29 | return new NativeFileSessionHandler($app['session.storage.save_path']); |
| 30 | 30 | }; |
| 31 | 31 | |
| 32 | - $app['session.storage.native'] = function ($app) { |
|
| 32 | + $app['session.storage.native'] = function($app) { |
|
| 33 | 33 | return new NativeSessionStorage( |
| 34 | 34 | $app['session.storage.options'], |
| 35 | 35 | $app['session.storage.handler'] |
| 36 | 36 | ); |
| 37 | 37 | }; |
| 38 | 38 | |
| 39 | - $app['session.listener'] = function ($app) { |
|
| 39 | + $app['session.listener'] = function($app) { |
|
| 40 | 40 | $listener = new SessionListener(); |
| 41 | 41 | $listener->setSession($app['session']); |
| 42 | 42 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $app['session.storage.options'] = []; |
| 47 | 47 | $app['session.storage.save_path'] = null; |
| 48 | 48 | |
| 49 | - $app->extend('event.dispatcher', function (EventDispatcher $eventDispatcher, $app) { |
|
| 49 | + $app->extend('event.dispatcher', function(EventDispatcher $eventDispatcher, $app) { |
|
| 50 | 50 | $eventDispatcher->addListener(ApplicationEvents::REQUEST, [$app['session.listener'], 'onRequest']); |
| 51 | 51 | $eventDispatcher->addListener(ApplicationEvents::RESPONSE, [$app['session.listener'], 'onResponse']); |
| 52 | 52 | |
@@ -14,12 +14,12 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | public function register(Container $app) |
| 16 | 16 | { |
| 17 | - $app['logger'] = function () use ($app) { |
|
| 17 | + $app['logger'] = function() use ($app) { |
|
| 18 | 18 | return $app['monolog']; |
| 19 | 19 | }; |
| 20 | 20 | |
| 21 | 21 | $app['monolog.logger.class'] = 'Monolog\\Logger'; |
| 22 | - $app['monolog'] = function ($app) { |
|
| 22 | + $app['monolog'] = function($app) { |
|
| 23 | 23 | $log = new $app['monolog.logger.class']($app['monolog.name']); |
| 24 | 24 | $log->pushHandler($app['monolog.handler']); |
| 25 | 25 | |
@@ -30,18 +30,18 @@ discard block |
||
| 30 | 30 | return $log; |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | - $app['monolog.formatter'] = function () { |
|
| 33 | + $app['monolog.formatter'] = function() { |
|
| 34 | 34 | return new LineFormatter(); |
| 35 | 35 | }; |
| 36 | 36 | |
| 37 | - $app['monolog.handler'] = function () use ($app) { |
|
| 37 | + $app['monolog.handler'] = function() use ($app) { |
|
| 38 | 38 | $handler = new StreamHandler($app['monolog.logfile'], $app['monolog.level'], $app['monolog.bubble'], $app['monolog.permission']); |
| 39 | 39 | $handler->setFormatter($app['monolog.formatter']); |
| 40 | 40 | |
| 41 | 41 | return $handler; |
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | - $app['monolog.level'] = function () { |
|
| 44 | + $app['monolog.level'] = function() { |
|
| 45 | 45 | return Logger::DEBUG; |
| 46 | 46 | }; |
| 47 | 47 | |
@@ -36,40 +36,40 @@ discard block |
||
| 36 | 36 | $this['debug'] = false; |
| 37 | 37 | $this['config'] = []; |
| 38 | 38 | |
| 39 | - $this['event.dispatcher'] = function () { |
|
| 39 | + $this['event.dispatcher'] = function() { |
|
| 40 | 40 | return new EventDispatcher(); |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | - $this['application.json_request_body'] = function () { |
|
| 43 | + $this['application.json_request_body'] = function() { |
|
| 44 | 44 | return new JsonRequestBody(); |
| 45 | 45 | }; |
| 46 | 46 | |
| 47 | - $this['controller.resolver'] = function () { |
|
| 47 | + $this['controller.resolver'] = function() { |
|
| 48 | 48 | return new ServiceControllerResolver($this); |
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | - $this['route.dispatcher'] = function () { |
|
| 51 | + $this['route.dispatcher'] = function() { |
|
| 52 | 52 | $dispatcher = new Dispatcher($this->getRouteCache()); |
| 53 | 53 | $dispatcher->setControllerResolver($this['controller.resolver']); |
| 54 | 54 | |
| 55 | 55 | return $dispatcher; |
| 56 | 56 | }; |
| 57 | 57 | |
| 58 | - $this['route.parser'] = function () { |
|
| 58 | + $this['route.parser'] = function() { |
|
| 59 | 59 | return new RouteParser(); |
| 60 | 60 | }; |
| 61 | 61 | |
| 62 | - $this['route.data_generator'] = function () { |
|
| 62 | + $this['route.data_generator'] = function() { |
|
| 63 | 63 | return new DataGenerator(); |
| 64 | 64 | }; |
| 65 | 65 | |
| 66 | - $this['route.collector'] = function () { |
|
| 66 | + $this['route.collector'] = function() { |
|
| 67 | 67 | return new RouteCollector($this['route.parser'], $this['route.data_generator']); |
| 68 | 68 | }; |
| 69 | 69 | |
| 70 | 70 | parent::__construct($values); |
| 71 | 71 | |
| 72 | - $this->extend('event.dispatcher', function (EventDispatcher $eventDispatcher) { |
|
| 72 | + $this->extend('event.dispatcher', function(EventDispatcher $eventDispatcher) { |
|
| 73 | 73 | $eventDispatcher->addListener(RequestEvent::NAME, [$this['application.json_request_body'], 'onRequest']); |
| 74 | 74 | |
| 75 | 75 | return $eventDispatcher; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $routeData = $this['route.collector']->getData(); |
| 88 | 88 | |
| 89 | 89 | if (!$this['debug'] && $routeCache) { |
| 90 | - file_put_contents($routeCache, '<?php return ' . var_export($routeData, true) . ';'); |
|
| 90 | + file_put_contents($routeCache, '<?php return '.var_export($routeData, true).';'); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | return $routeData; |
@@ -25,13 +25,13 @@ |
||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | if (strpos($input, ':') === false) { |
| 28 | - throw new \InvalidArgumentException('Unable to resolve provided controller: ' . $input); |
|
| 28 | + throw new \InvalidArgumentException('Unable to resolve provided controller: '.$input); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | list($controllerService, $method) = explode(':', $input); |
| 32 | 32 | |
| 33 | 33 | if (!isset($this->container[$controllerService])) { |
| 34 | - throw new \InvalidArgumentException('Unable to resolve provided controller service: ' . $controllerService); |
|
| 34 | + throw new \InvalidArgumentException('Unable to resolve provided controller service: '.$controllerService); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | return [$this->container[$controllerService], $method]; |
@@ -28,9 +28,9 @@ |
||
| 28 | 28 | |
| 29 | 29 | switch ($result[0]) { |
| 30 | 30 | case self::NOT_FOUND: |
| 31 | - throw new NotFoundHttpException('Route not found: ' . $request->getPathInfo()); |
|
| 31 | + throw new NotFoundHttpException('Route not found: '.$request->getPathInfo()); |
|
| 32 | 32 | case self::METHOD_NOT_ALLOWED: |
| 33 | - throw new MethodNotAllowedHttpException('Method not allowed: ' . $request->getMethod()); |
|
| 33 | + throw new MethodNotAllowedHttpException('Method not allowed: '.$request->getMethod()); |
|
| 34 | 34 | case self::FOUND: |
| 35 | 35 | $controller = $this->controllerResolver->getController($result[1]); |
| 36 | 36 | $params = array_values($result[2]); |