Passed
Branch master (817642)
by Henri
02:11
created
examples/MiddlewareExample.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
 use HnrAzevedo\Router\Router;
15 15
 use Psr\Http\Server\MiddlewareInterface;
16 16
 
17
-try{
17
+try {
18 18
     $requestMethod = (isset($_REQUEST['REQUEST_METHOD'])) ? $_REQUEST['REQUEST_METHOD'] : $_SERVER['REQUEST_METHOD'];
19 19
 
20 20
     $serverRequest = (new Factory())->createServerRequest($requestMethod, new Uri($_SERVER['REQUEST_URI']));
21 21
 
22
-    class App implements MiddlewareInterface{
22
+    class App implements MiddlewareInterface {
23 23
         public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
24 24
         {
25
-            if(empty($request->getAttribute('route')))
25
+            if (empty($request->getAttribute('route')))
26 26
             {
27 27
                 throw new Exception('Page not found', 404);
28 28
             }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         }
34 34
     }
35 35
 
36
-    define('GLOBAL_MIDDLEWARES',[
36
+    define('GLOBAL_MIDDLEWARES', [
37 37
         Router::class,
38 38
         App::class
39 39
     ]);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
     function runMiddlewares($serverRequest)
71 71
     {
72
-        nextExample(new class implements RequestHandlerInterface{
72
+        nextExample(new class implements RequestHandlerInterface {
73 73
             public function handle(ServerRequestInterface $request): ResponseInterface
74 74
             {
75 75
                 return (new Factory())->createResponse(200);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
     runMiddlewares($serverRequest);
81 81
 
82
-}catch(Exception $er){
82
+}catch (Exception $er) {
83 83
 
84 84
     die("Code Error: {$er->getCode()}<br>Line: {$er->getLine()}<br>File: {$er->getFile()}<br>Message: {$er->getMessage()}.");
85 85
 
Please login to merge, or discard this patch.