@@ -49,13 +49,13 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | public function register(Container $app) |
| 51 | 51 | { |
| 52 | - $app['piper'] = function () { |
|
| 52 | + $app['piper'] = function() { |
|
| 53 | 53 | return new MiddlewarePipe(); |
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | 56 | $app['handler.queue'] = []; |
| 57 | 57 | |
| 58 | - $app['uSilex.httpHandler'] = function ($app) { |
|
| 58 | + $app['uSilex.httpHandler'] = function($app) { |
|
| 59 | 59 | $piper = $app['piper']; |
| 60 | 60 | foreach ($app['handler.queue'] as $middlewareService) { |
| 61 | 61 | $piper->pipe($app[$middlewareService]); |
@@ -45,15 +45,15 @@ |
||
| 45 | 45 | { |
| 46 | 46 | $app['handler.queue'] = []; |
| 47 | 47 | |
| 48 | - $app['relay.pimpleResolver'] = $app->protect(function ($entry) use ($app) { |
|
| 48 | + $app['relay.pimpleResolver'] = $app->protect(function($entry) use ($app) { |
|
| 49 | 49 | return is_string($entry) ? $app[$entry] : $entry; |
| 50 | 50 | }); |
| 51 | 51 | |
| 52 | - $app['relay.factory'] = $app->protect(function ($queue) use ($app) { |
|
| 52 | + $app['relay.factory'] = $app->protect(function($queue) use ($app) { |
|
| 53 | 53 | return new Relay($queue, $app['relay.pimpleResolver']); |
| 54 | 54 | }); |
| 55 | 55 | |
| 56 | - $app['uSilex.httpHandler'] = function ($app) { |
|
| 56 | + $app['uSilex.httpHandler'] = function($app) { |
|
| 57 | 57 | return $app['relay.factory']($app['handler.queue']); |
| 58 | 58 | }; |
| 59 | 59 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | // ensure 'uSilex.responseEmitter' exists |
| 80 | 80 | if (!isset($this['uSilex.responseEmitter'])) { |
| 81 | - $this['uSilex.responseEmitter'] = $this->protect(function ($response) { |
|
| 81 | + $this['uSilex.responseEmitter'] = $this->protect(function($response) { |
|
| 82 | 82 | echo (string) $response->getBody(); |
| 83 | 83 | }); |
| 84 | 84 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $result = true; |
| 116 | 116 | } catch (Exception $e) { |
| 117 | 117 | if (isset($this['uSilex.exceptionHandler'])) { |
| 118 | - $response = isset($request) |
|
| 118 | + $response = isset($request) |
|
| 119 | 119 | ? call_user_func($this['uSilex.exceptionHandler'], $e, $request) |
| 120 | 120 | : call_user_func($this['uSilex.exceptionHandler'], $e); |
| 121 | 121 | call_user_func($this['uSilex.responseEmitter'], $response); |
@@ -46,15 +46,15 @@ |
||
| 46 | 46 | */ |
| 47 | 47 | public function register(Container $app) |
| 48 | 48 | { |
| 49 | - $app['uSilex.request'] = function () { |
|
| 49 | + $app['uSilex.request'] = function() { |
|
| 50 | 50 | return ServerRequestFactory::fromGlobals(); |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | - $app['uSilex.responseEmitter'] = $app->protect(function ($response) { |
|
| 53 | + $app['uSilex.responseEmitter'] = $app->protect(function($response) { |
|
| 54 | 54 | (new SapiStreamEmitter())->emit($response); |
| 55 | 55 | }); |
| 56 | 56 | |
| 57 | - $app['uSilex.exceptionHandler'] = $app->protect(function ($e) { |
|
| 57 | + $app['uSilex.exceptionHandler'] = $app->protect(function($e) { |
|
| 58 | 58 | return new TextResponse($e->getMessage(), 500); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -46,15 +46,15 @@ |
||
| 46 | 46 | */ |
| 47 | 47 | public function register(Container $app) |
| 48 | 48 | { |
| 49 | - $app['uSilex.request'] = function () { |
|
| 49 | + $app['uSilex.request'] = function() { |
|
| 50 | 50 | return ServerRequest::fromGlobals(); |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | - $app['uSilex.responseEmitter'] = $app->protect(function ($response) { |
|
| 53 | + $app['uSilex.responseEmitter'] = $app->protect(function($response) { |
|
| 54 | 54 | (new SapiStreamEmitter())->emit($response); |
| 55 | 55 | }); |
| 56 | 56 | |
| 57 | - $app['uSilex.exceptionHandler'] = $app->protect(function ($e) { |
|
| 57 | + $app['uSilex.exceptionHandler'] = $app->protect(function($e) { |
|
| 58 | 58 | return new Response(500, [], $e->getMessage()); |
| 59 | 59 | }); |
| 60 | 60 | } |