Completed
Push — master ( fab173...3e8504 )
by Sinnarasa
04:56
created
src/Routing/Router.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -120,13 +120,15 @@  discard block
 block discarded – undo
120 120
     public function run()
121 121
     {
122 122
         $this->setUrl();
123
-        if ($this->config['generateRoutesPath']) $this->collection->generateRoutesPath();
123
+        if ($this->config['generateRoutesPath']) {
124
+            $this->collection->generateRoutesPath();
125
+        }
124 126
         if ($this->match() === true) {
125 127
             $this->callMiddleware('before');
126 128
             if (!in_array(substr($this->response->getStatusCode(), 0, 1), [3,4,5])) {
127 129
                 $this->callTarget();
128 130
             }
129
-        }else{
131
+        } else{
130 132
             $this->response->setStatusCode(404);
131 133
         }
132 134
         $this->callMiddleware('after');
@@ -155,8 +157,9 @@  discard block
 block discarded – undo
155 157
      */
156 158
     public function setUrl($url = null)
157 159
     {
158
-        if (is_null($url))
159
-            $url = (isset($_GET['url'])) ? $_GET['url'] : substr(str_replace(str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']), '', $_SERVER['REQUEST_URI']), 1);
160
+        if (is_null($url)) {
161
+                    $url = (isset($_GET['url'])) ? $_GET['url'] : substr(str_replace(str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']), '', $_SERVER['REQUEST_URI']), 1);
162
+        }
160 163
         $this->route->setUrl('/' . trim(explode('?', $url)[0], '/'));
161 164
     }
162 165
 
@@ -166,7 +169,9 @@  discard block
 block discarded – undo
166 169
     public function match()
167 170
     {
168 171
         foreach ($this->matcher as $key => $matcher) {
169
-            if (call_user_func([$this->matcher[$key], 'match'])) return true;
172
+            if (call_user_func([$this->matcher[$key], 'match'])) {
173
+                return true;
174
+            }
170 175
         }
171 176
         return false;
172 177
     }
Please login to merge, or discard this patch.