Completed
Push — master ( 024fa5...c88b81 )
by Sinnarasa
01:53
created
src/Routing/Matcher/ArrayMatcher.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,7 +125,9 @@  discard block
 block discarded – undo
125 125
         $url = (isset($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : 'http') . '://' . ($host = (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']));
126 126
         $host = explode(':', $host)[0];
127 127
         $domain = $this->router->collection->getDomain($url);
128
-        if (!empty($this->request['subdomain']) && $route[0] == '/') $route = trim($this->request['subdomain'], '.') . '.' . $domain . $route;
128
+        if (!empty($this->request['subdomain']) && $route[0] == '/') {
129
+            $route = trim($this->request['subdomain'], '.') . '.' . $domain . $route;
130
+        }
129 131
         if ($route[0] == '/') {
130 132
             return ($host != $domain) ? false : true;
131 133
         } elseif ($route[0] != '/' && $host != $domain) {
@@ -333,14 +335,18 @@  discard block
 block discarded – undo
333 335
     {
334 336
         if (is_string($callback) && strpos($callback, '@') !== false) {
335 337
             $routes = explode('@', $callback);
336
-            if (!isset($routes[1])) $routes[1] = 'index';
338
+            if (!isset($routes[1])) {
339
+                $routes[1] = 'index';
340
+            }
337 341
             if ($routes[1] == '{method}') {
338 342
                 $params = explode('/', trim(preg_replace('#' . rtrim(str_replace('*', '', $this->request['route']), '/') . '#', '', $this->router->route->getUrl()), '/'));
339 343
                 $routes[1] = empty($params[0]) ? 'index' : $params[0];
340 344
                 $this->request['@method'] = $routes[1];
341 345
                 array_shift($params);
342 346
                 $this->request['parameters'] = array_merge($this->request['parameters'], $params);
343
-                if (preg_match('/[A-Z]/', $routes[1])) return false;
347
+                if (preg_match('/[A-Z]/', $routes[1])) {
348
+                    return false;
349
+                }
344 350
                 $routes[1] = lcfirst(str_replace(' ', '', ucwords(str_replace('-', ' ', $routes[1]))));
345 351
             }
346 352
             $index = isset($this->request['collection_index']) ? $this->request['collection_index'] : 0;
@@ -378,7 +384,9 @@  discard block
 block discarded – undo
378 384
             $target = null;
379 385
             if (in_array('.' . $extension, $this->router->getConfig()['templateExtension'])){
380 386
                 foreach ($viewDir as $dir) {
381
-                    if (is_file($fullPath = rtrim($dir, '/') . '/' . $path) || is_file($fullPath = $path)) $target = $fullPath;
387
+                    if (is_file($fullPath = rtrim($dir, '/') . '/' . $path) || is_file($fullPath = $path)) {
388
+                        $target = $fullPath;
389
+                    }
382 390
                 }
383 391
             }
384 392
             if(is_null($target)){
Please login to merge, or discard this patch.