Completed
Push — 4.0 ( bf6233...a1234e )
by Marco
13:59
created
src/Comodojo/Dispatcher/Router/Parser.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -116,6 +116,10 @@
 block discarded – undo
116 116
     }
117 117
 
118 118
     // This method read a single parameter and build the regular expression
119
+
120
+    /**
121
+     * @param Route $value
122
+     */
119 123
     private function param($key, $string, $value) {
120 124
 
121 125
         $field_required = false;
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Route.php 2 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -90,6 +90,11 @@
 block discarded – undo
90 90
 
91 91
     }
92 92
 
93
+    /**
94
+     * @param string $key
95
+     *
96
+     * @return string
97
+     */
93 98
     public function getParameter($key) {
94 99
 
95 100
         return (isset($this->parameters[$key]))?$this->parameters[$key]:null;
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -223,7 +223,10 @@
 block discarded – undo
223 223
                  */
224 224
                 if (preg_match('/^' . $value['regex'] . '$/', $bits[$key], $matches)) {
225 225
                     
226
-                    if (count($matches) == 1) $matches = $matches[0]; // This is the case where no backreferences are present or available.
226
+                    if (count($matches) == 1) {
227
+                        $matches = $matches[0];
228
+                    }
229
+                    // This is the case where no backreferences are present or available.
227 230
                     
228 231
                     // The extracted value (with any backreference available) is added to the query parameters.
229 232
                     $this->request->query()->set($key, $matches);
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Response/File.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public function getLocalName() {
63 63
         
64 64
         if (!empty($this->path))
65
-            return $this->path . "/" . $this->slug;
65
+            return $this->path."/".$this->slug;
66 66
         else
67 67
             return '';
68 68
     
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             !empty($this->path) &&
118 118
             !empty($this->slug) &&
119 119
             file_exists($this->getLocalName()) &&
120
-            file_exists($this->getLocalName() . ".data")
120
+            file_exists($this->getLocalName().".data")
121 121
         );
122 122
     
123 123
     }
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     
203 203
     private function loadFileInfo() {
204 204
         
205
-        $info = $this->getLocalName() . ".data";
205
+        $info = $this->getLocalName().".data";
206 206
         
207 207
         if (file_exists($info)) {
208 208
             
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     
224 224
     private function saveFileInfo() {
225 225
         
226
-        $info = $this->getLocalName() . ".data";
226
+        $info = $this->getLocalName().".data";
227 227
         
228 228
         if (!empty($this->path) && file_exists($this->path)) {
229 229
             
@@ -248,17 +248,17 @@  discard block
 block discarded – undo
248 248
         
249 249
         preg_match_all("/[a-z0-9]+/", iconv("UTF-8", "ASCII//TRANSLIT", strtolower(preg_replace('/\..*?$/', '', $this->fname))), $matches);
250 250
         
251
-        $this->slug  = implode('-', $matches[0]);
251
+        $this->slug = implode('-', $matches[0]);
252 252
         
253 253
         if (!empty($this->path)) {
254 254
             
255
-            $files = glob($this->path . "/" . $slug . "*");
255
+            $files = glob($this->path."/".$slug."*");
256 256
             
257
-            $count = count ($files);
257
+            $count = count($files);
258 258
             
259 259
             if ($count > 0) {
260 260
                 
261
-                $this->slug .= "-" . $count;
261
+                $this->slug .= "-".$count;
262 262
                 
263 263
             }
264 264
             
Please login to merge, or discard this patch.
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,10 +61,11 @@  discard block
 block discarded – undo
61 61
     
62 62
     public function getLocalName() {
63 63
         
64
-        if (!empty($this->path))
65
-            return $this->path . "/" . $this->slug;
66
-        else
67
-            return '';
64
+        if (!empty($this->path)) {
65
+                    return $this->path . "/" . $this->slug;
66
+        } else {
67
+                    return '';
68
+        }
68 69
     
69 70
     }
70 71
     
@@ -101,11 +102,13 @@  discard block
 block discarded – undo
101 102
     public function getFileData() {
102 103
    
103 104
         $file = $this->getTemporaryName();
104
-        if (empty($file))
105
-            $file = $this->getLocalName();
105
+        if (empty($file)) {
106
+                    $file = $this->getLocalName();
107
+        }
106 108
         
107
-        if (file_exists($file))
108
-            return file_get_contents($file);
109
+        if (file_exists($file)) {
110
+                    return file_get_contents($file);
111
+        }
109 112
         
110 113
         throw new DispatcherException("File does not exists");
111 114
     
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Model.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,7 +105,9 @@  discard block
 block discarded – undo
105 105
 
106 106
         if (!$this->bypass_routing) {
107 107
 
108
-            if (!$this->parse()) throw new DispatcherException("Unable to find a valid route for the specified uri", 0, null, 404);
108
+            if (!$this->parse()) {
109
+                throw new DispatcherException("Unable to find a valid route for the specified uri", 0, null, 404);
110
+            }
109 111
 
110 112
         }
111 113
 
@@ -133,8 +135,9 @@  discard block
 block discarded – undo
133 135
                 $this->extra
134 136
             );
135 137
 
138
+        } else {
139
+            return null;
136 140
         }
137
-        else return null;
138 141
         
139 142
     }
140 143
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Table.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 
118 118
     public function load($routes) {
119 119
 
120
-        if ( !empty($routes) ) {
120
+        if (!empty($routes)) {
121 121
 
122
-            foreach( $routes as $name => $route ) {
122
+            foreach ($routes as $name => $route) {
123 123
 
124 124
                 $this->add($route['route'], $route['type'], $route['class'], $route['parameters']);
125 125
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
     private function readCache() {
137 137
 
138
-        if ( $this->configuration()->get('routing-table-cache') !== true ) return;
138
+        if ($this->configuration()->get('routing-table-cache') !== true) return;
139 139
 
140 140
         $this->routes = $this->cache->setNamespace('dispatcherinternals')->get("dispatcher-routes");
141 141
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
     private function dumpCache() {
149 149
 
150
-        if ( $this->configuration()->get('routing-table-cache') !== true ) return;
150
+        if ($this->configuration()->get('routing-table-cache') !== true) return;
151 151
 
152 152
         $ttl = $this->configuration()->get('routing-table-ttl');
153 153
 
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
             ->setClassName($class) // Class to be invoked
167 167
             ->setParameters($parameters); // Parameters passed via the composer.json configuration (cache, ttl, etc...)
168 168
 
169
-        $this->logger->debug("ROUTE: " . implode("/", $folders));
169
+        $this->logger->debug("ROUTE: ".implode("/", $folders));
170 170
 
171 171
         //$this->logger->debug("PARAMETERS: " . var_export($value, true));
172 172
 
173 173
         // This method generate a global regular expression which will be able to match all the URI supported by the route
174 174
         $regex = $this->parser->read($folders, $route);
175 175
 
176
-        $this->logger->debug("ROUTE: " . $regex);
176
+        $this->logger->debug("ROUTE: ".$regex);
177 177
 
178 178
         //$this->logger->debug("PARAMETERS: " . var_export($value, true));
179 179
 
Please login to merge, or discard this patch.