Passed
Branch master (d115e1)
by Mr
03:59
created
src/Config.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
         /**
18 18
          * Parse array of parameters and store as class attributes
19 19
          */
20
-        foreach ($parameters as $key => $value) $this->$key = $value;
20
+        foreach ($parameters as $key => $value) {
21
+            $this->$key = $value;
22
+        }
21 23
 
22 24
         /**
23 25
          * Return object of current class
Please login to merge, or discard this patch.
src/Di.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public function set($name, $definition)
19 19
     {
20
-        if ($definition instanceof \Closure) $definition = $definition();
20
+        if ($definition instanceof \Closure) {
21
+            $definition = $definition();
22
+        }
21 23
 
22 24
         $this->dependencies[$name] = $definition;
23 25
 
@@ -53,6 +55,8 @@  discard block
 block discarded – undo
53 55
      */
54 56
     public function remove($name)
55 57
     {
56
-        if (isset($this->dependencies[$name])) unset($this->dependencies[$name]);
58
+        if (isset($this->dependencies[$name])) {
59
+            unset($this->dependencies[$name]);
60
+        }
57 61
     }
58 62
 }
Please login to merge, or discard this patch.
src/Core/Route.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     {
34 34
         // The URI should be considered literal except for keys and optional parts
35 35
         // Escape everything preg_quote would escape except for : ( ) < >
36
-        $expression = preg_replace('#'.Route::REGEX_ESCAPE.'#', '\\\\$0', $uri);
36
+        $expression = preg_replace('#' . Route::REGEX_ESCAPE . '#', '\\\\$0', $uri);
37 37
 
38 38
         if (strpos($expression, '(') !== FALSE)
39 39
         {
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
         }
43 43
 
44 44
         // Insert default regex for keys
45
-        $expression = str_replace(array('<', '>'), array('(?P<', '>'.Route::REGEX_SEGMENT.')'), $expression);
45
+        $expression = str_replace(array('<', '>'), array('(?P<', '>' . Route::REGEX_SEGMENT . ')'), $expression);
46 46
 
47 47
         if ($regex)
48 48
         {
49 49
             $search = $replace = array();
50 50
             foreach ($regex as $key => $value)
51 51
             {
52
-                $search[]  = "<$key>".Route::REGEX_SEGMENT;
52
+                $search[]  = "<$key>" . Route::REGEX_SEGMENT;
53 53
                 $replace[] = "<$key>$value";
54 54
             }
55 55
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             $expression = str_replace($search, $replace, $expression);
58 58
         }
59 59
 
60
-        return '#^'.$expression.'$#uD';
60
+        return '#^' . $expression . '$#uD';
61 61
     }
62 62
 
63 63
     /**
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
             return;
105 105
         }
106 106
 
107
-        if ( ! empty($uri))
107
+        if (!empty($uri))
108 108
         {
109 109
             $this->_uri = $uri;
110 110
         }
111 111
 
112
-        if ( ! empty($regex))
112
+        if (!empty($regex))
113 113
         {
114 114
             $this->_regex = $regex;
115 115
         }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         $uri = trim($request->uri(), '/');
148 148
 // 		$uri = $request->uri();
149 149
 
150
-        if ( ! preg_match($this->_route_regex, $uri, $matches))
150
+        if (!preg_match($this->_route_regex, $uri, $matches))
151 151
             return FALSE;
152 152
 
153 153
         $params = array();
@@ -166,20 +166,20 @@  discard block
 block discarded – undo
166 166
 
167 167
         foreach ($this->_defaults as $key => $value)
168 168
         {
169
-            if ( ! isset($params[$key]) OR $params[$key] === '')
169
+            if (!isset($params[$key]) OR $params[$key] === '')
170 170
             {
171 171
                 // Set default values for any key that was not matched
172 172
                 $params[$key] = $value;
173 173
             }
174 174
         }
175 175
 
176
-        if ( ! empty($params['controller']))
176
+        if (!empty($params['controller']))
177 177
         {
178 178
             // PSR-0: Replace underscores with spaces, run ucwords, then replace underscore
179 179
             $params['controller'] = str_replace(' ', '_', ucwords(str_replace('_', ' ', $params['controller'])));
180 180
         }
181 181
 
182
-        if ( ! empty($params['directory']))
182
+        if (!empty($params['directory']))
183 183
         {
184 184
             // PSR-0: Replace underscores with spaces, run ucwords, then replace underscore
185 185
             $params['directory'] = str_replace(' ', '_', ucwords(str_replace('_', ' ', $params['directory'])));
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
          * @param   boolean $required   Whether or not parameters are required (initially)
211 211
          * @return  array   Tuple of the compiled portion and whether or not it contained specified parameters
212 212
          */
213
-        $compile = function ($portion, $required) use (&$compile, $defaults, $params)
213
+        $compile = function($portion, $required) use (&$compile, $defaults, $params)
214 214
         {
215 215
             $missing = array();
216 216
 
217
-            $pattern = '#(?:'.Route::REGEX_KEY.'|'.Route::REGEX_GROUP.')#';
218
-            $result = preg_replace_callback($pattern, function ($matches) use (&$compile, $defaults, &$missing, $params, &$required)
217
+            $pattern = '#(?:' . Route::REGEX_KEY . '|' . Route::REGEX_GROUP . ')#';
218
+            $result = preg_replace_callback($pattern, function($matches) use (&$compile, $defaults, &$missing, $params, &$required)
219 219
             {
220 220
                 if ($matches[0][0] === '<')
221 221
                 {
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                     {
227 227
                         // This portion is required when a specified
228 228
                         // parameter does not match the default
229
-                        $required = ($required OR ! isset($defaults[$param]) OR $params[$param] !== $defaults[$param]);
229
+                        $required = ($required OR !isset($defaults[$param]) OR $params[$param] !== $defaults[$param]);
230 230
 
231 231
                         // Add specified parameter to this result
232 232
                         return $params[$param];
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -147,8 +147,9 @@  discard block
 block discarded – undo
147 147
         $uri = trim($request->uri(), '/');
148 148
 // 		$uri = $request->uri();
149 149
 
150
-        if ( ! preg_match($this->_route_regex, $uri, $matches))
151
-            return FALSE;
150
+        if ( ! preg_match($this->_route_regex, $uri, $matches)) {
151
+                    return FALSE;
152
+        }
152 153
 
153 154
         $params = array();
154 155
         foreach ($matches as $key => $value)
@@ -233,13 +234,13 @@  discard block
 block discarded – undo
233 234
                     }
234 235
 
235 236
                     // Add default parameter to this result
236
-                    if (isset($defaults[$param]))
237
-                        return $defaults[$param];
237
+                    if (isset($defaults[$param])) {
238
+                                            return $defaults[$param];
239
+                    }
238 240
 
239 241
                     // This portion is missing a parameter
240 242
                     $missing[] = $param;
241
-                }
242
-                else
243
+                } else
243 244
                 {
244 245
                     // Group, unwrapped
245 246
                     $result = $compile($matches[2], FALSE);
Please login to merge, or discard this patch.
src/Core/View.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,8 +59,11 @@  discard block
 block discarded – undo
59 59
     public function registerEngines(array $engines = array())
60 60
     {
61 61
         foreach ($engines as $key => $value) {
62
-            if ($value instanceof \Closure) $this->_engines[$key] = $value();
63
-            else $this->_engines[$key] = $value;
62
+            if ($value instanceof \Closure) {
63
+                $this->_engines[$key] = $value();
64
+            } else {
65
+                $this->_engines[$key] = $value;
66
+            }
64 67
         }
65 68
     }
66 69
 
@@ -73,7 +76,9 @@  discard block
 block discarded – undo
73 76
      */
74 77
     public function render($path, $data = false)
75 78
     {
76
-        if ($data === false) $data = $this->data;
79
+        if ($data === false) {
80
+            $data = $this->data;
81
+        }
77 82
 
78 83
         // Application view
79 84
         $appfile = APPPATH . 'Views' . DIRECTORY_SEPARATOR . THEME . DIRECTORY_SEPARATOR . $path . '.php';
Please login to merge, or discard this patch.