Passed
Push — master ( fb704f...f5e971 )
by Henri
01:25
created
src/DefinitionsTrait.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
         }
70 70
 
71 71
         $routes[strval($index)] = [
72
-			'uri' => serialize(new Uri(self::getInstance()->getHost().self::getInstance()->getPrefix().$uri)),
73
-			'action' => (is_callable($closure)) ? serialize(new SerializableClosure($closure)) : serialize($closure),
74
-			'method' => strtoupper($method),
72
+            'uri' => serialize(new Uri(self::getInstance()->getHost().self::getInstance()->getPrefix().$uri)),
73
+            'action' => (is_callable($closure)) ? serialize(new SerializableClosure($closure)) : serialize($closure),
74
+            'method' => strtoupper($method),
75 75
             'middlewares' => [],
76 76
             'where' => [],
77 77
             'before' => [],
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     private static function checkDuplicity(string $uri, string $method): void
90 90
     {
91 91
         foreach(self::getInstance()->getRoutes() as $route){
92
-    		if( md5($route['uri'].$route['method']) === md5($uri.$method) ){
92
+            if( md5($route['uri'].$route['method']) === md5($uri.$method) ){
93 93
                 throw new \RuntimeException("There is already a route with the URI {$uri} and with the {$method} METHOD configured.");
94 94
             }
95 95
         }
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
 
@@ -13,32 +13,32 @@  discard block
 block discarded – undo
13 13
     
14 14
     public static function get(string $uri, $closure): RouterInterface
15 15
     {
16
-        return self::set('get',$uri,$closure);
16
+        return self::set('get', $uri, $closure);
17 17
     }
18 18
 
19 19
     public static function post(string $uri, $closure): RouterInterface
20 20
     {
21
-        return self::set('post',$uri,$closure);
21
+        return self::set('post', $uri, $closure);
22 22
     }
23 23
 
24 24
     public static function ajax(string $uri, $closure): RouterInterface
25 25
     {
26
-        return self::set('ajax',$uri,$closure);
26
+        return self::set('ajax', $uri, $closure);
27 27
     }
28 28
 
29 29
     public static function delete(string $uri, $closure): RouterInterface
30 30
     {
31
-        return self::set('delete',$uri,$closure);
31
+        return self::set('delete', $uri, $closure);
32 32
     }
33 33
 
34 34
     public static function put(string $uri, $closure): RouterInterface
35 35
     {
36
-        return self::set('put',$uri,$closure);
36
+        return self::set('put', $uri, $closure);
37 37
     }
38 38
 
39 39
     public static function patch(string $uri, $closure): RouterInterface
40 40
     {
41
-        return self::set('patch',$uri,$closure);
41
+        return self::set('patch', $uri, $closure);
42 42
     }
43 43
 
44 44
     public static function match(string $method, string $uri, $closure): RouterInterface
@@ -49,22 +49,22 @@  discard block
 block discarded – undo
49 49
 
50 50
     public static function any(string $uri, $closure): RouterInterface
51 51
     {
52
-        return self::set('*',$uri,$closure);
52
+        return self::set('*', $uri, $closure);
53 53
     }
54 54
 
55 55
     private static $count = 0;
56 56
 
57 57
     private static function set(string $method, string $uri, $closure): RouterInterface
58 58
     {   
59
-        $uri = (substr($uri,0,1) !=='/' and strlen($uri) > 0) ? "/{$uri}" : $uri;
59
+        $uri = (substr($uri, 0, 1) !== '/' and strlen($uri) > 0) ? "/{$uri}" : $uri;
60 60
         
61
-        self::checkDuplicity($uri,$method);
61
+        self::checkDuplicity($uri, $method);
62 62
         
63 63
         $routes = self::getInstance()->getRoutes();
64 64
 
65 65
         $index = count($routes);
66 66
 
67
-        while(array_key_exists($index, $routes)){
67
+        while (array_key_exists($index, $routes)) {
68 68
             $index++;
69 69
         }
70 70
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 
89 89
     private static function checkDuplicity(string $uri, string $method): void
90 90
     {
91
-        foreach(self::getInstance()->getRoutes() as $route){
92
-    		if( md5($route['uri'].$route['method']) === md5($uri.$method) ){
91
+        foreach (self::getInstance()->getRoutes() as $route) {
92
+    		if (md5($route['uri'].$route['method']) === md5($uri.$method)) {
93 93
                 throw new \RuntimeException("There is already a route with the URI {$uri} and with the {$method} METHOD configured.");
94 94
             }
95 95
         }
Please login to merge, or discard this patch.