Completed
Push — 4.0 ( 1533b9...4d1c3b )
by Marco
13:08
created
src/Router/RoutingTable.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -62,6 +62,9 @@
 block discarded – undo
62 62
         
63 63
     }
64 64
     
65
+    /**
66
+     * @param string $route
67
+     */
65 68
     public function get($route) {
66 69
         
67 70
         $folders = explode("/", $route);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                 $this->readpath( 
129 129
                     $folders,
130 130
                     $value,
131
-                    $regex.'(?:\/'.$param_regex.')'. (($param_required)?'{1}':'?')
131
+                    $regex.'(?:\/'.$param_regex.')'.(($param_required) ? '{1}' : '?')
132 132
                 );
133 133
                 
134 134
             } else {
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $string = preg_replace('/(?<!\\)\((?!\?)/', '(?:', $string);
172 172
         $string = preg_replace('/\.([\*\+])(?!\?)/', '.\${1}?', $string);
173 173
         
174
-        return '(?P<' . $key . '>' . $string . ')' . (($field_required)?'{1}':'?');
174
+        return '(?P<'.$key.'>'.$string.')'.(($field_required) ? '{1}' : '?');
175 175
         
176 176
     }
177 177
     
Please login to merge, or discard this patch.
Braces   +11 added lines, -6 removed lines patch added patch discarded remove patch
@@ -68,10 +68,11 @@  discard block
 block discarded – undo
68 68
         
69 69
         $regex = $this->readpath($folders);
70 70
         
71
-        if (isset($this->routes[$regex])) 
72
-            return $this->routes[$regex];
73
-        else 
74
-            return null;
71
+        if (isset($this->routes[$regex])) {
72
+                    return $this->routes[$regex];
73
+        } else {
74
+                    return null;
75
+        }
75 76
         
76 77
     }
77 78
     
@@ -81,7 +82,9 @@  discard block
 block discarded – undo
81 82
         
82 83
         $regex = $this->readpath($folders);
83 84
         
84
-        if (isset($this->routes[$regex])) unset($this->routes[$regex]);
85
+        if (isset($this->routes[$regex])) {
86
+            unset($this->routes[$regex]);
87
+        }
85 88
         
86 89
     }
87 90
     
@@ -99,7 +102,9 @@  discard block
 block discarded – undo
99 102
     
100 103
     private function readpath($folders = array(), &$value = null, $regex = '') {
101 104
         
102
-        if (!empty($folders) && empty($folders[0])) array_shift($folders);
105
+        if (!empty($folders) && empty($folders[0])) {
106
+            array_shift($folders);
107
+        }
103 108
         
104 109
         if (empty($folders)) {
105 110
             
Please login to merge, or discard this patch.
src/Router/Collector.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             
133 133
             $result = "";
134 134
 
135
-            switch( $_SERVER['REQUEST_METHOD'] ) {
135
+            switch ($_SERVER['REQUEST_METHOD']) {
136 136
     
137 137
                 case 'POST':
138 138
     
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         
178 178
         foreach ($this->table as $regex => $value) {
179 179
             
180
-            if (preg_match("/" . $regex . "/", $path, $matches)) {
180
+            if (preg_match("/".$regex."/", $path, $matches)) {
181 181
                 
182 182
                 $this->evalUri($value['query'], $matches);
183 183
                 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                 $this->classname  = $value['class'];
191 191
                 $this->type       = $value['type'];
192 192
                 $this->service    = implode('.', $value['service']);
193
-                $this->service    = empty($this->service)?"default":$this->service;
193
+                $this->service    = empty($this->service) ? "default" : $this->service;
194 194
                 
195 195
                 return true;
196 196
                 
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
     
205 205
     private function evalUri($parameters, $bits) {
206 206
         
207
-        $count  = 0;
207
+        $count = 0;
208 208
         
209 209
         foreach ($parameters as $key => $value) {
210 210
             
211 211
             if (isset($bits[$key])) {
212 212
                 
213
-                if (preg_match('/^' . $value['regex'] . '$/', $bits[$key], $matches)) {
213
+                if (preg_match('/^'.$value['regex'].'$/', $bits[$key], $matches)) {
214 214
                     
215 215
                     if (count($matches) == 1) $matches = $matches[0];
216 216
                     
Please login to merge, or discard this patch.