@@ -58,8 +58,8 @@ |
||
| 58 | 58 | |
| 59 | 59 | $app['uSilex.httpHandler'] = function($app) { |
| 60 | 60 | $piper = $app['piper']; |
| 61 | - foreach ($app['handler.queue'] as $middlewareService){ |
|
| 62 | - $piper->pipe( $app[$middlewareService]); |
|
| 61 | + foreach ($app['handler.queue'] as $middlewareService) { |
|
| 62 | + $piper->pipe($app[$middlewareService]); |
|
| 63 | 63 | } |
| 64 | 64 | return $piper; |
| 65 | 65 | }; |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | use uSilex\Application; |
| 4 | 4 | use uSilex\Psr11Trait; |
| 5 | 5 | use uSilex\Provider\Psr15\RelayServiceProvider as Psr15Provider; |
| 6 | -use uSilex\Provider\Psr7\DiactorosServiceProvider as Psr7Provider ; |
|
| 6 | +use uSilex\Provider\Psr7\DiactorosServiceProvider as Psr7Provider; |
|
| 7 | 7 | use Psr\Http\Message\ResponseInterface; |
| 8 | 8 | use Psr\Http\Message\ServerRequestInterface; |
| 9 | 9 | use Psr\Http\Server\RequestHandlerInterface; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | class MyMiddleware implements MiddlewareInterface {
|
| 14 | 14 | use Psr11Trait; |
| 15 | 15 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface {
|
| 16 | - return new \Zend\Diactoros\Response\TextResponse( $this->get('message'));
|
|
| 16 | + return new \Zend\Diactoros\Response\TextResponse($this->get('message'));
|
|
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
@@ -9,11 +9,11 @@ |
||
| 9 | 9 | class MyMiddleware implements MiddlewareInterface {
|
| 10 | 10 | use \uSilex\Psr11Trait; |
| 11 | 11 | |
| 12 | - public function process(ServerRequestInterface $request,RequestHandlerInterface $handler): ResponseInterface |
|
| 12 | + public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
| 13 | 13 | {
|
| 14 | 14 | // Return a text message in the container or a generic greeting... |
| 15 | - $message = $this->has('message')?$this->get('message'):'Hi';
|
|
| 15 | + $message = $this->has('message') ? $this->get('message') : 'Hi';
|
|
| 16 | 16 | |
| 17 | - return new \Zend\Diactoros\Response\TextResponse( $message); |
|
| 17 | + return new \Zend\Diactoros\Response\TextResponse($message); |
|
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | \ No newline at end of file |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | 44 | // using standard middleware as defaultt page |
| 45 | - $app['default_page'] = function($app) { return new MyMiddleware($app);}; |
|
| 45 | + $app['default_page'] = function($app) { return new MyMiddleware($app); }; |
|
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | |
| 6 | 6 | $app = new \uSilex\Application; |
| 7 | 7 | $app['uSilex.request'] = \Zend\Diactoros\ServerRequestFactory::fromGlobals(); |
| 8 | -$app['uSilex.responseEmitter'] = $app->protect( function($response) {echo $response->getBody();});
|
|
| 8 | +$app['uSilex.responseEmitter'] = $app->protect(function($response) {echo $response->getBody(); });
|
|
| 9 | 9 | $app['uSilex.httpHandler'] = function($app) {
|
| 10 | 10 | return new \Relay\Relay([new MyMiddleware($app)]); |
| 11 | 11 | }; |