Completed
Push — 4.0 ( 2bab8b...b7ae43 )
by Marco
14:12
created
src/Router/Collector.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -47,6 +47,10 @@  discard block
 block discarded – undo
47 47
 
48 48
     private $table      = array();
49 49
 
50
+    /**
51
+     * @param \Comodojo\Dispatcher\Components\Configuration $routing_table
52
+     * @param \Comodojo\Cache\CacheManager $logger
53
+     */
50 54
     public function __construct($routing_table, $configuration = null, $logger = null, $cache = null) {
51 55
 
52 56
         parent::__construct($configuration, $logger);
@@ -173,6 +177,9 @@  discard block
 block discarded – undo
173 177
         
174 178
     }
175 179
     
180
+    /**
181
+     * @param string[] $bits
182
+     */
176 183
     private function evalUri($parameters, $bits) {
177 184
         
178 185
         $count  = 0;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         
150 150
         foreach ($this->table as $regex => $value) {
151 151
             
152
-            if (preg_match("/" . $regex . "/", $path, $matches)) {
152
+            if (preg_match("/".$regex."/", $path, $matches)) {
153 153
                 
154 154
                 $this->evalUri($value['query'], $matches);
155 155
                 
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
     
176 176
     private function evalUri($parameters, $bits) {
177 177
         
178
-        $count  = 0;
178
+        $count = 0;
179 179
         
180 180
         foreach ($parameters as $key => $value) {
181 181
             
182 182
             if (isset($bits[$key])) {
183 183
                 
184
-                if (preg_match('/' . $value['regex'] . '/', $bits[$key], $matches)) {
184
+                if (preg_match('/'.$value['regex'].'/', $bits[$key], $matches)) {
185 185
                     
186 186
                     if (count($matches) == 1) $matches = $matches[0];
187 187
                     
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,8 +96,9 @@  discard block
 block discarded – undo
96 96
                 $this->response
97 97
             );
98 98
             
99
+        } else {
100
+            return null;
99 101
         }
100
-        else return null;
101 102
         
102 103
     }
103 104
 
@@ -183,7 +184,9 @@  discard block
 block discarded – undo
183 184
                 
184 185
                 if (preg_match('/' . $value['regex'] . '/', $bits[$key], $matches)) {
185 186
                     
186
-                    if (count($matches) == 1) $matches = $matches[0];
187
+                    if (count($matches) == 1) {
188
+                        $matches = $matches[0];
189
+                    }
187 190
                     
188 191
                     $this->request->query()->set($key, $matches);
189 192
                     
Please login to merge, or discard this patch.
src/Dispatcher.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
         $this->events = new Emitter();
64 64
 
65
-        $this->cache = new CacheManager( CacheManager::PICK_FIRST );
65
+        $this->cache = new CacheManager(CacheManager::PICK_FIRST);
66 66
 
67 67
         $this->request = new Request($this->configuration, $this->logger);
68 68
 
@@ -110,33 +110,33 @@  discard block
 block discarded – undo
110 110
 
111 111
     public function dispatch() {
112 112
 
113
-        $this->events->emit( new DispatcherEvent($this) );
113
+        $this->events->emit(new DispatcherEvent($this));
114 114
 
115
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request') );
115
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request'));
116 116
 
117
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request->method()->get()) );
117
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request->method()->get()));
118 118
 
119
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request.#') );
119
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request.#'));
120 120
 
121 121
         $this->router->route($this->request);
122 122
 
123
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route') );
123
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route'));
124 124
 
125
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$this->router->getType()) );
125
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$this->router->getType()));
126 126
 
127
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$this->router->getService()) );
127
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$this->router->getService()));
128 128
 
129
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.#') );
129
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.#'));
130 130
 
131 131
         // translate route to service
132 132
 
133 133
         $this->router->compose($this->response);
134 134
 
135
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response') );
135
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response'));
136 136
 
137
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status()->get()) );
137
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status()->get()));
138 138
 
139
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.#') );
139
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.#'));
140 140
 
141 141
         $return = Processor::parse($this->configuration, $this->logger, $this->response);
142 142
 
Please login to merge, or discard this patch.
src/Request/Query.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 
47 47
     private static function getParameters() {
48 48
 
49
-        switch( $_SERVER['REQUEST_METHOD'] ) {
49
+        switch ($_SERVER['REQUEST_METHOD']) {
50 50
 
51 51
             case 'POST':
52 52
 
Please login to merge, or discard this patch.
src/Router/RoutingTable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,14 +124,14 @@
 block discarded – undo
124 124
                     $value = preg_replace('/(?<!\\)\((?!\?)/', '(?:', $value);
125 125
                     $value = preg_replace('/\.([\*\+])(?!\?)/', '.\${1}?', $value);
126 126
                     
127
-                    $param_regex .= '(?P<' . $key . '>' . $value . ')' . (($field_required)?'{1}':'?');
127
+                    $param_regex .= '(?P<'.$key.'>'.$value.')'.(($field_required) ? '{1}' : '?');
128 128
                     
129 129
                 }
130 130
                 
131 131
                 $this->readpath( 
132 132
                     $folders,
133 133
                     $value,
134
-                    $regex.'(?:\/'.$param_regex.')'. (($param_required)?'{1}':'?')
134
+                    $regex.'(?:\/'.$param_regex.')'.(($param_required) ? '{1}' : '?')
135 135
                 );
136 136
                 
137 137
             } else {
Please login to merge, or discard this patch.