Completed
Push — master ( 4cd17e...ba4a87 )
by Sinnarasa
02:20
created
src/Routing/Router.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
      * @param ResponseInterface $response
47 47
      * @param Route $route
48 48
      */
49
-    public function __construct(RouteCollection $collection,ResponseInterface $response = null,Route $route = null)
49
+    public function __construct(RouteCollection $collection, ResponseInterface $response = null, Route $route = null)
50 50
     {
51 51
         $this->collection = $collection;
52
-        $this->response = is_null($response)? new Response() : $response;
52
+        $this->response = is_null($response) ? new Response() : $response;
53 53
         $this->response->setStatusCode(404);
54
-        $this->route = is_null($route)? new Route() : $route;
55
-        $this->config['di'] = function($class){
54
+        $this->route = is_null($route) ? new Route() : $route;
55
+        $this->config['di'] = function($class) {
56 56
             return new $class;
57 57
         };
58 58
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     /**
77 77
      * @param string $matcher
78 78
      */
79
-    public function addMatcher($matcher){
79
+    public function addMatcher($matcher) {
80 80
         $this->config['matcher'][] = $matcher;
81 81
     }
82 82
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     public function callTarget()
124 124
     {
125 125
         $target = $this->route->getTarget('dispatcher');
126
-        if(!empty($target)) {
126
+        if (!empty($target)) {
127 127
             $this->dispatcher = new $target($this->route, $this->response);
128 128
             return call_user_func([$this->dispatcher, 'call']);
129 129
         }
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
     {
158 158
         if (isset($this->route->getDetail()['response_templates']) && isset($this->route->getDetail()['response_templates'][$code = $this->response->getStatusCode()])) {
159 159
             $this->route->setCallback($this->route->getDetail()['response_templates'][$code]);
160
-            foreach($this->config['matcherInstance'] as $matcher) {
160
+            foreach ($this->config['matcherInstance'] as $matcher) {
161 161
                 foreach (call_user_func([$matcher, 'getMatcher']) as $match)
162
-                    if (call_user_func([$matcher, $match])){ $this->callTarget(); break; }
162
+                    if (call_user_func([$matcher, $match])) { $this->callTarget(); break; }
163 163
             }
164 164
             $this->response->setStatusCode($code);
165 165
         }
Please login to merge, or discard this patch.