Passed
Pull Request — master (#1)
by Henri
01:23
created
src/RunInTrait.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace HnrAzevedo\Router;
6 6
 
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     protected function getState(string $state, bool $except = false)
19 19
     {
20
-        if($state === 'before'){
20
+        if ($state === 'before') {
21 21
             return ($except) ? $this->beforeExcepts : $this->beforeAll;
22 22
         }
23 23
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 
27 27
     protected function setState(string $state, $settable, bool $except = false): bool
28 28
     {
29
-        if($state === 'before'){
30
-            if($except){
29
+        if ($state === 'before') {
30
+            if ($except) {
31 31
                 $this->beforeExcepts = $settable;
32 32
                 return true;
33 33
             }
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             return true;
37 37
         }
38 38
 
39
-        if($except){
39
+        if ($except) {
40 40
             $this->afterExcepts = $settable;
41 41
             return true;
42 42
         }
@@ -47,24 +47,24 @@  discard block
 block discarded – undo
47 47
 
48 48
     public static function before($closure): RouterInterface
49 49
     {
50
-        return self::addInRoute('before',$closure);
50
+        return self::addInRoute('before', $closure);
51 51
     }
52 52
 
53 53
     public static function after($closure): RouterInterface
54 54
     {
55
-        return self::addInRoute('after',$closure);
55
+        return self::addInRoute('after', $closure);
56 56
     }
57 57
 
58 58
     public static function beforeAll($closure, $excepts): RouterInterface
59 59
     {
60
-        self::getInstance()->setState('before', (is_array($excepts)) ? $excepts : [ $excepts ] ,true);
60
+        self::getInstance()->setState('before', (is_array($excepts)) ? $excepts : [$excepts], true);
61 61
         self::getInstance()->setState('before', $closure, false);
62 62
         return self::getInstance();
63 63
     }
64 64
 
65 65
     public static function afterAll($closure, $excepts): RouterInterface
66 66
     {
67
-        self::getInstance()->setState('after', (is_array($excepts)) ? $excepts : [ $excepts ] ,true);
67
+        self::getInstance()->setState('after', (is_array($excepts)) ? $excepts : [$excepts], true);
68 68
         self::getInstance()->setState('after', $closure, false);
69 69
         return self::getInstance();
70 70
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
     protected function executeRouteAction($action): bool
83 83
     {
84
-        if(is_callable($action)){        
84
+        if (is_callable($action)) {        
85 85
             call_user_func_array($action, $_REQUEST);
86 86
             return true;
87 87
         }
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
     private static function addInRoutes(string $state, $closure, $excepts): RouterInterface
94 94
     {
95 95
         self::getInstance()->isInPseudGroup();
96
-        $excepts = (is_array($excepts)) ? $excepts : [ $excepts ];
96
+        $excepts = (is_array($excepts)) ? $excepts : [$excepts];
97 97
         $group = self::getInstance()->inSave()['group'];
98 98
 
99
-        foreach(self::getInstance()->getRoutes() as $r => $route){
100
-            if($route['group'] === $group && !in_array($r,$excepts)){
101
-                self::getInstance()->getRoutes()[$r][$state] = (is_null($route[$state])) ? [ $closure ] : array_merge($route[$state], [ $closure ]); 
99
+        foreach (self::getInstance()->getRoutes() as $r => $route) {
100
+            if ($route['group'] === $group && !in_array($r, $excepts)) {
101
+                self::getInstance()->getRoutes()[$r][$state] = (is_null($route[$state])) ? [$closure] : array_merge($route[$state], [$closure]); 
102 102
             }
103 103
         }
104 104
 
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
     private static function addInRoute(string $state, $closure): RouterInterface
109 109
     {
110 110
         $route = self::getInstance()->inSave();
111
-        $route[$state] = (!is_null($route[$state])) ? [ $closure ] : array_merge($route[$state], [ $closure ]);
112
-        self::updateRoute($route,array_key_last(self::getInstance()->getRoutes()));
111
+        $route[$state] = (!is_null($route[$state])) ? [$closure] : array_merge($route[$state], [$closure]);
112
+        self::updateRoute($route, array_key_last(self::getInstance()->getRoutes()));
113 113
         return self::getInstance();
114 114
     }
115 115
 
116 116
     protected function executeBefore(): void
117 117
     {
118
-        if(!in_array($this->currentName(), (array) $this->getState('before', true))){
118
+        if (!in_array($this->currentName(), (array) $this->getState('before', true))) {
119 119
             ($this->getState('before', false))();
120 120
         }
121 121
 
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
     {
127 127
         $this->executeState('after');
128 128
 
129
-        if(!in_array($this->currentName(), (array) $this->getState('after', true))){
129
+        if (!in_array($this->currentName(), (array) $this->getState('after', true))) {
130 130
             ($this->getState('after', false))();
131 131
         }
132 132
     }
133 133
 
134 134
     private function executeState(string $stage): void
135 135
     {
136
-        foreach($this->current()[$stage] as $state){
137
-            if(is_callable($state)){
136
+        foreach ($this->current()[$stage] as $state) {
137
+            if (is_callable($state)) {
138 138
                 $state();
139 139
                 continue;
140 140
             }
@@ -145,31 +145,31 @@  discard block
 block discarded – undo
145 145
 
146 146
     private function executeController(string $controllerMeth): void
147 147
     {
148
-        if(count(explode('@',$controllerMeth)) !== 2){
148
+        if (count(explode('@', $controllerMeth)) !== 2) {
149 149
             $path = urldecode($this->current()['uri']->getPath());
150 150
             throw new \RuntimeException("Misconfigured route action ({$path})");
151 151
         }
152 152
 
153
-        $controller = (string) explode('@',$controllerMeth)[0];
154
-        $method = (string) explode('@',$controllerMeth)[1];
153
+        $controller = (string) explode('@', $controllerMeth)[0];
154
+        $method = (string) explode('@', $controllerMeth)[1];
155 155
 
156 156
         $this->checkControllerMeth($controllerMeth);
157 157
 
158
-        call_user_func_array([(new $controller()),$method], $_REQUEST);
158
+        call_user_func_array([(new $controller()), $method], $_REQUEST);
159 159
     }
160 160
 
161 161
     private function checkControllerMeth(string $controllerMeth): void
162 162
     {
163
-        $routeURI = str_replace(['{:','{','}'],'',urldecode($this->current()['uri']->getPath()));
163
+        $routeURI = str_replace(['{:', '{', '}'], '', urldecode($this->current()['uri']->getPath()));
164 164
 
165
-        $controller = (string) explode('@',$controllerMeth)[0];
166
-        $method = (string) explode('@',$controllerMeth)[1];
165
+        $controller = (string) explode('@', $controllerMeth)[0];
166
+        $method = (string) explode('@', $controllerMeth)[1];
167 167
 
168
-        if(!class_exists($controller)){
168
+        if (!class_exists($controller)) {
169 169
             throw new \RuntimeException("Controller not found in route URI {$routeURI}");
170 170
         }
171 171
 
172
-        if(!method_exists($controller, $method)){
172
+        if (!method_exists($controller, $method)) {
173 173
             throw new \RuntimeException("Method {$method} not found in controller {$controller} in route URI {$routeURI}");
174 174
         }
175 175
         
Please login to merge, or discard this patch.
src/Router.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                 self::getInstance()->checkMethod($route, $_SERVER['REQUEST_METHOD']);
64 64
                 self::getInstance()->checkData($route, (new Uri($_SERVER['REQUEST_URI']))->getPath());
65 65
                 return self::getInstance();
66
-            }catch(\Exception $er){
66
+            } catch(\Exception $er){
67 67
                 continue;
68 68
             }
69 69
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         
90 90
         try{
91 91
             self::getInstance()->executeRouteAction(self::getInstance()->current()['action']);
92
-        }catch(\Exception $er){
92
+        } catch(\Exception $er){
93 93
             self::getInstance()->error = $er;
94 94
         }
95 95
         
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace HnrAzevedo\Router;
6 6
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     public static function group(string $prefix, \Closure $closure): Router
34 34
     {
35 35
         $id = sha1(date('d/m/Y h:m:i'));
36
-        while(array_key_exists($id, self::getInstance()->groupsName)){
36
+        while (array_key_exists($id, self::getInstance()->groupsName)) {
37 37
             $id = sha1(date('d/m/Y h:m:i').$id);
38 38
         }
39 39
 
@@ -54,21 +54,21 @@  discard block
 block discarded – undo
54 54
     {
55 55
         self::getInstance()->loaded = true;
56 56
 
57
-        if(null !== $name){
57
+        if (null !== $name) {
58 58
             return self::getInstance()->loadByName($name);
59 59
         }
60 60
 
61 61
         self::getInstance()->sortRoutes();
62 62
 
63
-        foreach(self::getInstance()->getRoutes() as $r => $route){
63
+        foreach (self::getInstance()->getRoutes() as $r => $route) {
64 64
             self::getInstance()->currentRoute = $route;
65 65
             self::getInstance()->currentRoute['name'] = $r;
66 66
 
67
-            try{
67
+            try {
68 68
                 self::getInstance()->checkMethod($route, $_SERVER['REQUEST_METHOD']);
69 69
                 self::getInstance()->checkData($route, (new Uri($_SERVER['REQUEST_URI']))->getPath());
70 70
                 return self::getInstance();
71
-            }catch(\Exception $er){
71
+            }catch (\Exception $er) {
72 72
                 continue;
73 73
             }
74 74
         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
     public static function run(?string $name = null): RouterInterface
84 84
     {
85
-        if(!self::getInstance()->loaded){
85
+        if (!self::getInstance()->loaded) {
86 86
             self::getInstance()->load($name);
87 87
         }
88 88
 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 
93 93
         self::getInstance()->executeBefore();
94 94
         
95
-        try{
95
+        try {
96 96
             self::getInstance()->executeRouteAction(self::getInstance()->current()['action']);
97
-        }catch(\Exception $er){
97
+        }catch (\Exception $er) {
98 98
             self::getInstance()->error = $er;
99 99
         }
100 100
         
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
     private function checkError(): void
109 109
     {
110
-        if(isset($this->error)){
110
+        if (isset($this->error)) {
111 111
             throw $this->error;
112 112
         }
113 113
     }
Please login to merge, or discard this patch.
src/DefinitionsTrait.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
         }
67 67
 
68 68
         $routes[$index] = [
69
-			'uri' => new Uri(self::getInstance()->getHost().self::getInstance()->getPrefix().$uri),
70
-			'action' => $closure,
71
-			'method' => strtoupper($method),
69
+            'uri' => new Uri(self::getInstance()->getHost().self::getInstance()->getPrefix().$uri),
70
+            'action' => $closure,
71
+            'method' => strtoupper($method),
72 72
             'middlewares' => [],
73 73
             'where' => [],
74 74
             'before' => [],
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     private static function checkDuplicity(string $uri, string $method): void
87 87
     {
88 88
         foreach(self::getInstance()->getRoutes() as $route){
89
-    		if( md5($route['uri'].$route['method']) === md5($uri.$method) ){
89
+            if( md5($route['uri'].$route['method']) === md5($uri.$method) ){
90 90
                 throw new \RuntimeException("There is already a route with the URI {$uri} and with the {$method} METHOD configured.");
91 91
             }
92 92
         }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace HnrAzevedo\Router;
6 6
 
@@ -12,32 +12,32 @@  discard block
 block discarded – undo
12 12
     
13 13
     public static function get(string $uri, $closure): RouterInterface
14 14
     {
15
-        return self::set('get',$uri,$closure);
15
+        return self::set('get', $uri, $closure);
16 16
     }
17 17
 
18 18
     public static function post(string $uri, $closure): RouterInterface
19 19
     {
20
-        return self::set('post',$uri,$closure);
20
+        return self::set('post', $uri, $closure);
21 21
     }
22 22
 
23 23
     public static function ajax(string $uri, $closure): RouterInterface
24 24
     {
25
-        return self::set('ajax',$uri,$closure);
25
+        return self::set('ajax', $uri, $closure);
26 26
     }
27 27
 
28 28
     public static function delete(string $uri, $closure): RouterInterface
29 29
     {
30
-        return self::set('delete',$uri,$closure);
30
+        return self::set('delete', $uri, $closure);
31 31
     }
32 32
 
33 33
     public static function put(string $uri, $closure): RouterInterface
34 34
     {
35
-        return self::set('put',$uri,$closure);
35
+        return self::set('put', $uri, $closure);
36 36
     }
37 37
 
38 38
     public static function patch(string $uri, $closure): RouterInterface
39 39
     {
40
-        return self::set('patch',$uri,$closure);
40
+        return self::set('patch', $uri, $closure);
41 41
     }
42 42
 
43 43
     public static function match(string $method, string $uri, $closure): RouterInterface
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
 
49 49
     public static function any(string $uri, $closure): RouterInterface
50 50
     {
51
-        return self::set('*',$uri,$closure);
51
+        return self::set('*', $uri, $closure);
52 52
     }
53 53
 
54 54
     private static function set(string $method, string $uri, $closure): RouterInterface
55 55
     {   
56
-        $uri = (substr($uri,0,1) !=='/' and strlen($uri) > 0) ? "/{$uri}" : $uri;
56
+        $uri = (substr($uri, 0, 1) !== '/' and strlen($uri) > 0) ? "/{$uri}" : $uri;
57 57
         
58
-        self::checkDuplicity($uri,$method);
58
+        self::checkDuplicity($uri, $method);
59 59
         
60 60
         $routes = self::getInstance()->getRoutes();
61 61
 
62 62
         $index = sha1(date('d/m/Y H:i:s').count($routes));
63 63
 
64
-        while(array_key_exists($index,$routes)){
64
+        while (array_key_exists($index, $routes)) {
65 65
             $index = sha1(date('d/m/Y H:i:s').rand(count($routes)));
66 66
         }
67 67
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 
86 86
     private static function checkDuplicity(string $uri, string $method): void
87 87
     {
88
-        foreach(self::getInstance()->getRoutes() as $route){
89
-    		if( md5($route['uri'].$route['method']) === md5($uri.$method) ){
88
+        foreach (self::getInstance()->getRoutes() as $route) {
89
+    		if (md5($route['uri'].$route['method']) === md5($uri.$method)) {
90 90
                 throw new \RuntimeException("There is already a route with the URI {$uri} and with the {$method} METHOD configured.");
91 91
             }
92 92
         }
Please login to merge, or discard this patch.
src/CurrentTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace HnrAzevedo\Router;
6 6
 
Please login to merge, or discard this patch.
src/OwnerTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace HnrAzevedo\Router;
6 6
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     {
20 20
         $this->hasRouteName($name);
21 21
 
22
-        if(!$this->loaded()){
22
+        if (!$this->loaded()) {
23 23
             $this->loadIn($name);
24 24
         }
25 25
         
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function hasCurrentRoute(): void
30 30
     {
31
-        if(!isset($this->currentRoute)){
31
+        if (!isset($this->currentRoute)) {
32 32
             throw new \RuntimeException('Route not yet loaded');
33 33
         }
34 34
     }
Please login to merge, or discard this patch.
src/MiddlewareTrait.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace HnrAzevedo\Router;
6 6
 
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 
21 21
     public static function globalMiddlewares(array $middlewares): RouterInterface
22 22
     {
23
-        foreach($middlewares as $middleware){
24
-            if(!class_exists($middleware)){
23
+        foreach ($middlewares as $middleware) {
24
+            if (!class_exists($middleware)) {
25 25
                 throw new \RuntimeException("Middleware class {$middleware} not exists");
26 26
             }
27 27
         }
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
     public static function middleware(array $middlewares): RouterInterface
38 38
     {
39 39
         $route = self::getInstance()->inSave();
40
-        $route['middlewares'] = (is_array($route['middlewares'])) ? array_merge($route['middlewares'],$middlewares) : $middlewares;
41
-        self::getInstance()->updateRoute($route,array_key_last(self::getInstance()->getRoutes()));
40
+        $route['middlewares'] = (is_array($route['middlewares'])) ? array_merge($route['middlewares'], $middlewares) : $middlewares;
41
+        self::getInstance()->updateRoute($route, array_key_last(self::getInstance()->getRoutes()));
42 42
         return self::getInstance();
43 43
     }
44 44
 
45 45
     public static function groupMiddlewares(array $middlewares, array $excepts): RouterInterface
46 46
     {
47 47
         $group = self::getInstance()->inSave()['group'];
48
-        foreach(self::getInstance()->getRoutes() as $r => $route){
49
-            if($route['group'] !== $group || in_array($route['name'], $excepts)){
48
+        foreach (self::getInstance()->getRoutes() as $r => $route) {
49
+            if ($route['group'] !== $group || in_array($route['name'], $excepts)) {
50 50
                 continue;
51 51
             }
52 52
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
     private static function existMiddleware(string $name): void
60 60
     {
61
-        if(!class_exists($name) && !array_key_exists($name,self::$globalMiddlewares)){
61
+        if (!class_exists($name) && !array_key_exists($name, self::$globalMiddlewares)) {
62 62
             throw new \RuntimeException("Middleware {$name} does not exist");
63 63
         }
64 64
     }
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $factory = new Factory();
69 69
 
70
-        $this->serverRequest = (!isset($this->serverRequest)) ? $factory->createServerRequest($_SERVER['REQUEST_METHOD'], $this->current()['uri'],['route' => $this->current()]) : $this->serverRequest;
70
+        $this->serverRequest = (!isset($this->serverRequest)) ? $factory->createServerRequest($_SERVER['REQUEST_METHOD'], $this->current()['uri'], ['route' => $this->current()]) : $this->serverRequest;
71 71
         
72
-        foreach ($this->current()['middlewares'] as $middleware){
72
+        foreach ($this->current()['middlewares'] as $middleware) {
73 73
             $this->currentMiddlewares[] = (class_exists($middleware)) ? new $middleware() : new $this->globalMiddlewares[$middleware]();
74 74
         }
75 75
 
@@ -84,20 +84,20 @@  discard block
 block discarded – undo
84 84
 
85 85
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
86 86
     {
87
-        if(!$this->getInstance()->loaded()){
87
+        if (!$this->getInstance()->loaded()) {
88 88
             $this->getInstance()->load();
89 89
         }
90 90
 
91 91
         $route = $this->getInstance()->current();
92
-        if(!empty($route)){
93
-            $route['action'] = function(){
92
+        if (!empty($route)) {
93
+            $route['action'] = function() {
94 94
                 $this->getInstance()->executeBefore();
95 95
                 $this->getInstance()->executeRouteAction($this->getInstance()->current()['action']);
96 96
                 $this->getInstance()->executeAfter();
97 97
             };
98 98
         }
99 99
 
100
-        return $this->next($handler)->handle($request->withAttribute('route',$route));
100
+        return $this->next($handler)->handle($request->withAttribute('route', $route));
101 101
     }
102 102
 
103 103
     private function next(RequestHandlerInterface $defaultHandler): RequestHandlerInterface
Please login to merge, or discard this patch.
examples/Routes/default.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Defines a route for the GET method
9 9
  */
10
-Router::get('/foo','\HnrAzevedo\Router\Examples\Controller@method');
10
+Router::get('/foo', '\HnrAzevedo\Router\Examples\Controller@method');
11 11
 
12 12
 /**
13 13
  * Defines a route to the GET method with an anonymous function
14 14
  */
15
-Router::get('/bar', function(){
15
+Router::get('/bar', function() {
16 16
     //
17 17
 });
18 18
 
19 19
 /**
20 20
  * Defines a route to the POST method with an anonymous function
21 21
  */
22
-Router::post('/bar', function(){
22
+Router::post('/bar', function() {
23 23
     //
24 24
 });
25 25
 
26 26
 /**
27 27
  * Defining route for any method
28 28
  */
29
-Router::any('/any', function(){
29
+Router::any('/any', function() {
30 30
     //
31 31
 });
32 32
 
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
  * @param string $route
37 37
  * @param \Closure|string $action
38 38
  */
39
-Router::match('GET|post', '/get_post', function(){
39
+Router::match('GET|post', '/get_post', function() {
40 40
     //
41 41
 });
42 42
 
43 43
 /**
44 44
  * Defines the route name
45 45
  */
46
-Router::get('/named', function(){
46
+Router::get('/named', function() {
47 47
     //
48 48
 })->name('baz');
49 49
 
@@ -55,32 +55,32 @@  discard block
 block discarded – undo
55 55
 /**
56 56
  * Run before all requests, regardless of error occurrences
57 57
  */
58
-Router::beforeAll(function(){
58
+Router::beforeAll(function() {
59 59
     //
60 60
 }, null);
61 61
 
62 62
 /**
63 63
  * Run after all requests, regardless of error occurrences
64 64
  */
65
-Router::afterAll(function(){
65
+Router::afterAll(function() {
66 66
     //
67 67
 }, null);
68 68
 
69 69
 /**
70 70
  * Executes after executing the triggered route action
71 71
  */
72
-Router::get('/after', function(){
72
+Router::get('/after', function() {
73 73
     //
74
-})->after(function(){
74
+})->after(function() {
75 75
     //
76 76
 });
77 77
 
78 78
 /**
79 79
  * Executes before executing the triggered route action
80 80
  */
81
-Router::get('/before', function(){
81
+Router::get('/before', function() {
82 82
     //
83
-})->before(function(){
83
+})->before(function() {
84 84
     //
85 85
 });
86 86
 /**
@@ -101,21 +101,21 @@  discard block
 block discarded – undo
101 101
 /**
102 102
  * Example of route definition with parameters
103 103
  */
104
-Router::get('/passingParameters/{param}', function($param){
104
+Router::get('/passingParameters/{param}', function($param) {
105 105
     echo $param;
106 106
 });
107 107
 
108 108
 /**
109 109
  * Example of setting an optional parameter
110 110
  */
111
-Router::get('/passingParameters/{:optionalParam}', function($optionalParam){
111
+Router::get('/passingParameters/{:optionalParam}', function($optionalParam) {
112 112
     echo $optionalParam;
113 113
 });
114 114
 
115 115
 /**
116 116
  * Example of regular expression test for parameters
117 117
  */
118
-Router::get('/testingParameters/{param}', function($param){
118
+Router::get('/testingParameters/{param}', function($param) {
119 119
     echo $param;
120 120
 })->where([
121 121
     'param'=>'[0-9]{1,11}'
@@ -131,16 +131,16 @@  discard block
 block discarded – undo
131 131
  * @param string $prefix
132 132
  * @param \Closure $routeDefinitions
133 133
  */
134
-Router::group('/admin', function(){
135
-    Router::get('/users/{teste}', function($teste){
134
+Router::group('/admin', function() {
135
+    Router::get('/users/{teste}', function($teste) {
136 136
         echo $teste;
137 137
     })->where([
138 138
         'teste'=>'[a-zA-Z]*'
139 139
     ]);
140 140
 });
141 141
 
142
-Router::group('/admin2', function(){
143
-    Router::get('/users/{teste}', function($teste){
142
+Router::group('/admin2', function() {
143
+    Router::get('/users/{teste}', function($teste) {
144 144
         echo $teste;
145 145
     })->name('teste');
146 146
 })
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
  */
152 152
 ->groupWhere([
153 153
     'teste'=>'[a-zA-Z]*'
154
-],[]);
154
+], []);
155 155
 
156 156
 
157 157
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 /**
169 169
  * Defining route middleware - implements Psr\Http\Server\MiddlewareInterface
170 170
  */
171
-Router::get('/passingParameters/{:optionalParam}', function($optionalParam = null){
171
+Router::get('/passingParameters/{:optionalParam}', function($optionalParam = null) {
172 172
     echo $optionalParam;
173 173
 })->middleware([
174 174
     HnrAzevedo\Router\Example\Middleware\Auth::class
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 /**
178 178
  * Defining middleware by nickname
179 179
  */
180
-Router::get('/lasted', function(){
180
+Router::get('/lasted', function() {
181 181
     //
182 182
 })->middleware([
183 183
     'Lasted'
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
  * Defining multiple middlewares
188 188
  * NOTE: Importantly, the execution follows the same order of definition
189 189
  */
190
-Router::get('/middlewares', function(){
190
+Router::get('/middlewares', function() {
191 191
     //
192 192
 })->middleware([
193 193
     HnrAzevedo\Router\Example\Middleware\Auth::class,
Please login to merge, or discard this patch.