Test Setup Failed
Branch master (872b00)
by Josh
03:09
created
Zewa/App.php 2 patches
Doc Comments   +9 added lines, -1 removed lines patch added patch discarded remove patch
@@ -170,6 +170,9 @@  discard block
 block discarded – undo
170 170
         $this->class = '\\App\\Modules\\' . $this->module . '\\Controllers\\' . ucfirst($this->controller);
171 171
     }
172 172
 
173
+    /**
174
+     * @param string $service
175
+     */
173 176
     public static function getService($service, $new = false, $options = [])
174 177
     {
175 178
         if ($new === false) {
@@ -180,6 +183,9 @@  discard block
 block discarded – undo
180 183
         }
181 184
     }
182 185
 
186
+    /**
187
+     * @param string $service
188
+     */
183 189
     public static function setService($service, $class)
184 190
     {
185 191
         self::$services->$service = $class;
@@ -329,7 +335,6 @@  discard block
 block discarded – undo
329 335
      * Attach (or remove) multiple callbacks to an event and trigger those callbacks when that event is called.
330 336
      *
331 337
      * @param string $event name
332
-     * @param mixed $value the optional value to pass to each callback
333 338
      * @param mixed $callback the method or function to call - FALSE to remove all callbacks for event
334 339
      */
335 340
 
@@ -344,6 +349,9 @@  discard block
 block discarded – undo
344 349
 
345 350
     }
346 351
 
352
+    /**
353
+     * @param string $event
354
+     */
347 355
     public function callEvent($event, $method = false, $arguments = [])
348 356
     {
349 357
         if (isset(self::$events[$event])) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     {
175 175
         if ($new === false) {
176 176
             return self::$services->$service;
177
-        } elseif ($new === true || empty ( self::$services->$service )) {
177
+        } elseif ($new === true || empty (self::$services->$service)) {
178 178
             self::$services->$service = call_user_func_array(self::$services->$service, $options);
179 179
             return self::$services->$service;
180 180
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     public function getConfiguration($config = null)
193 193
     {
194 194
         if ($config !== null) {
195
-            if (! empty ( $this->configuration->$config )) {
195
+            if (!empty ($this->configuration->$config)) {
196 196
                 return $this->configuration->$config;
197 197
             }
198 198
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function setConfiguration($config = null, $configObject = null)
214 214
     {
215
-        if ($config !== null && $configObject !== null && !empty( $configObject )) {
215
+        if ($config !== null && $configObject !== null && !empty($configObject)) {
216 216
             $this->configuration->$config = $configObject;
217 217
             return true;
218 218
         } elseif ($config === null && $configObject === null) {
Please login to merge, or discard this patch.
Zewa/Router.php 3 patches
Doc Comments   +18 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,6 +122,9 @@  discard block
 block discarded – undo
122 122
     }
123 123
 
124 124
 
125
+    /**
126
+     * @param string $uri
127
+     */
125 128
     private function isURIClean($uri, $uriChunks)
126 129
     {
127 130
         if (!preg_match("/^[a-z0-9:_\/\.\[\]-]+$/i", $uri)
@@ -138,6 +141,10 @@  discard block
 block discarded – undo
138 141
     }
139 142
 
140 143
     //@TODO add Security class.
144
+
145
+    /**
146
+     * @param string $data
147
+     */
141 148
     private function normalize($data)
142 149
     {
143 150
         if (is_numeric($data)) {
@@ -218,6 +225,9 @@  discard block
 block discarded – undo
218 225
         return $normalizedURI;
219 226
     }
220 227
 
228
+    /**
229
+     * @param string $uri
230
+     */
221 231
     private function discoverRoute($uri)
222 232
     {
223 233
         $routes = $this->configuration->routes;
@@ -249,6 +259,7 @@  discard block
 block discarded – undo
249 259
      * Normalize the $_SERVER vars for formatting the URI.
250 260
      *
251 261
      * @access public
262
+     * @param string $uri
252 263
      * @return string formatted/u/r/l
253 264
      */
254 265
     private function uri($uri)
@@ -307,6 +318,9 @@  discard block
 block discarded – undo
307 318
         return array_merge($return, array_values($uriChunks));
308 319
     }
309 320
 
321
+    /**
322
+     * @param string $url
323
+     */
310 324
     private function addQueryString($url, $key, $value)
311 325
     {
312 326
         $url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&');
@@ -318,6 +332,9 @@  discard block
 block discarded – undo
318 332
         }
319 333
     }
320 334
 
335
+    /**
336
+     * @param string $url
337
+     */
321 338
     private function removeQueryString($url, $key)
322 339
     {
323 340
         $url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&');
@@ -392,7 +409,7 @@  discard block
 block discarded – undo
392 409
      * Set optional status header, and redirect to provided URL
393 410
      *
394 411
      * @access public
395
-     * @return bool
412
+     * @return false|null
396 413
      */
397 414
     public function redirect($url = '/', $status = null)
398 415
     {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
     {
336 336
         if (trim($_SERVER['REQUEST_URI']) === '/') {
337 337
             $url = $this->baseURL()
338
-                   . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '');
338
+                    . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '');
339 339
         } else {
340 340
             $url = $this->baseURL($this->uri)
341
-                   . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '');
341
+                    . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '');
342 342
         }
343 343
 
344 344
         if (!empty($params)) {
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
         if (is_null($this->baseURL)) {
363 363
             $self = $_SERVER['PHP_SELF'];
364 364
             $server = $_SERVER['HTTP_HOST']
365
-                      . rtrim(str_replace(strstr($self, 'index.php'), '', $self), '/');
365
+                        . rtrim(str_replace(strstr($self, 'index.php'), '', $self), '/');
366 366
 
367 367
             if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')
368 368
                 || !empty($_SERVER['HTTP_X_FORWARDED_PROTO'])
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     private function isURIClean($uri, $uriChunks)
126 126
     {
127 127
         if (!preg_match("/^[a-z0-9:_\/\.\[\]-]+$/i", $uri)
128
-            || array_filter($uriChunks, function ($uriChunk) {
128
+            || array_filter($uriChunks, function($uriChunk) {
129 129
                 if (strpos($uriChunk, '__') !== false) {
130 130
                     return true;
131 131
                 }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 
212 212
         $normalizedURI = ltrim(preg_replace('/\?.*/', '', $normalizedURI), '/');
213 213
 
214
-        if (! empty ( $this->configuration->routes )) {
214
+        if (!empty ($this->configuration->routes)) {
215 215
             $normalizedURI = $this->discoverRoute($normalizedURI);
216 216
         }
217 217
         
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 
231 231
                 $uri = $reroute;
232 232
 
233
-                if (! empty ( $params )) {
233
+                if (!empty ($params)) {
234 234
                     $pat = '/(\$\d+)/';
235
-                    $uri = preg_replace_callback($pat, function () use (&$params) {
235
+                    $uri = preg_replace_callback($pat, function() use (&$params) {
236 236
                         $first = $params[0];
237 237
                         array_shift($params);
238 238
                         return $first;
Please login to merge, or discard this patch.
Zewa/SessionHandler.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -162,6 +162,9 @@
 block discarded – undo
162 162
 
163 163
     }
164 164
 
165
+    /**
166
+     * @param string $sessionId
167
+     */
165 168
     public function destroy($sessionId)
166 169
     {
167 170
         $success = false;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         ini_set('session.cookie_domain', $domain);
33 33
 
34 34
         if ($session_lifetime != '' && is_integer($session_lifetime)) {
35
-            ini_set('session.gc_maxlifetime', (int) $session_lifetime);
35
+            ini_set('session.gc_maxlifetime', (int)$session_lifetime);
36 36
         }
37 37
 
38 38
         if ($gc_probability != '' && is_integer($gc_probability)) {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
         if ($interface !== 'file') {
80 80
             try {
81
-                $database = new Database();//App::getService('database')->fetchConnection();
81
+                $database = new Database(); //App::getService('database')->fetchConnection();
82 82
                 $this->dbh = $database->fetchConnection('default');
83 83
 
84 84
                 session_set_save_handler(
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     public function destroy($sessionId)
166 166
     {
167 167
         $success = false;
168
-        $query = "DELETE FROM ". $this->tableName
168
+        $query = "DELETE FROM " . $this->tableName
169 169
             . " WHERE id = ?";
170 170
 
171 171
         $success = $this->dbh->prepare($query)
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     public function gc()
182 182
     {
183 183
 
184
-        $query = "DELETE FROM ". $this->tableName
184
+        $query = "DELETE FROM " . $this->tableName
185 185
             . " WHERE session_expire < ?";
186 186
 
187 187
         return $this->dbh->prepare($query)
Please login to merge, or discard this patch.
Zewa/View.php 2 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,8 +89,6 @@  discard block
 block discarded – undo
89 89
      *
90 90
      * @access public
91 91
      *
92
-     * @param string $requestedView relative path for the view
93
-     * @param string $renderName array of data to expose to view
94 92
      *
95 93
      * @throws \Exception when a view can not be found
96 94
      */
@@ -185,6 +183,10 @@  discard block
 block discarded – undo
185 183
      * @return string processed content
186 184
      */
187 185
     //@TODO: come back and clean up this and the way the view receives stuff
186
+
187
+    /**
188
+     * @param string|boolean $file
189
+     */
188 190
     private function process($file)
189 191
     {
190 192
         ob_start();
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@
 block discarded – undo
226 226
         }
227 227
 
228 228
         foreach ($sheets as $sheet) {
229
-            $string .= '<link rel="stylesheet" href="' . $sheet .'">' . "\r\n";
229
+            $string .= '<link rel="stylesheet" href="' . $sheet . '">' . "\r\n";
230 230
         }
231 231
 
232 232
         return $string;
Please login to merge, or discard this patch.
Zewa/Request.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -327,13 +327,13 @@  discard block
 block discarded – undo
327 327
             $data = $new;
328 328
         } else {
329 329
             $data = trim($data);
330
- //            if (function_exists('iconv') && function_exists('mb_detect_encoding')) {
331
- //                $current_encoding = mb_detect_encoding($data);
332
- //
333
- //                if ($current_encoding != 'UTF-8' && $current_encoding != 'UTF-16') {
334
- //                    $data = iconv($current_encoding, 'UTF-8', $data);
335
- //                }
336
- //            }
330
+    //            if (function_exists('iconv') && function_exists('mb_detect_encoding')) {
331
+    //                $current_encoding = mb_detect_encoding($data);
332
+    //
333
+    //                if ($current_encoding != 'UTF-8' && $current_encoding != 'UTF-16') {
334
+    //                    $data = iconv($current_encoding, 'UTF-8', $data);
335
+    //                }
336
+    //            }
337 337
             //Global XXS?
338 338
             //we need to review this.
339 339
             if (function_exists('iconv') && function_exists('mb_detect_encoding')) {
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
                     $data = iconv($current_encoding, 'UTF-8', $data);
344 344
                 }
345 345
             }
346
- //            Global XXS?
346
+    //            Global XXS?
347 347
             // This is not sanitary.  FILTER_SANITIZE_STRING doesn't do much.
348 348
 
349
- //            $data = filter_var($data, FILTER_SANITIZE_STRING);
349
+    //            $data = filter_var($data, FILTER_SANITIZE_STRING);
350 350
 
351 351
             if (is_numeric($data)) {
352 352
                 if ((intval($data) === (int)trim($data, '-')) && strlen((string)(int)$data) === strlen($data)) {
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                     $data = (float) $data;
356 356
                 }
357 357
             } else {
358
- //                $data = $this->purifier->purify($data);
358
+    //                $data = $this->purifier->purify($data);
359 359
             }
360 360
         }
361 361
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                 // iterate through all the entries
169 169
                 foreach ($this->flashdata as $variable => $data) {
170 170
                     // increment counter representing server requests
171
-                    $this->flashdata[$variable]['inc'] ++;
171
+                    $this->flashdata[$variable]['inc']++;
172 172
 
173 173
                     // if we're past the first server request
174 174
                     if ($this->flashdata[$variable]['inc'] > 1) {
@@ -350,9 +350,9 @@  discard block
 block discarded – undo
350 350
 
351 351
             if (is_numeric($data)) {
352 352
                 if ((intval($data) === (int)trim($data, '-')) && strlen((string)(int)$data) === strlen($data)) {
353
-                    $data = (int) $data;
353
+                    $data = (int)$data;
354 354
                 } elseif ($data === (string)(float)$data) {
355
-                    $data = (float) $data;
355
+                    $data = (float)$data;
356 356
                 }
357 357
             } else {
358 358
  //                $data = $this->purifier->purify($data);
@@ -370,12 +370,12 @@  discard block
 block discarded – undo
370 370
             $container = $name . 'Container';
371 371
             $container = $this->$container;
372 372
 
373
-            $argument = ! empty( $arguments[0] ) ? $arguments[0] : false;
373
+            $argument = !empty($arguments[0]) ? $arguments[0] : false;
374 374
 
375 375
             if ($argument === false && !empty($container)) {
376 376
                 return $container;
377 377
             }
378
-            if (! empty ( $container[$argument] )) {
378
+            if (!empty ($container[$argument])) {
379 379
                 if (!is_array($container[$argument])
380 380
                     && !is_object($container[$argument])
381 381
                     && strlen($container[$argument]) > 0
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                 }
387 387
             }
388 388
 
389
-            return ! empty ( $arguments[1] ) ? $arguments[1] : false;
389
+            return !empty ($arguments[1]) ? $arguments[1] : false;
390 390
         }
391 391
 
392 392
         throw new Exception\FunctionException('Method ' . $name . ' does not exist.');
Please login to merge, or discard this patch.
Zewa/Database.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
     public function establishConnection($name = 'default')
32 32
     {
33 33
         if ($this->configuration !== false) {
34
-            if (! empty ( $this->configuration->$name )) {
34
+            if (!empty ($this->configuration->$name)) {
35 35
                 $dbConfig = $this->configuration->$name;
36 36
                 self::$dbh[$name] = new \PDO($dbConfig->dsn, $dbConfig->user, $dbConfig->pass);
37 37
                 self::$dbh[$name]->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
Please login to merge, or discard this patch.
Zewa/ServiceManager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function __construct()
18 18
     {
19
-        $database = function () {
19
+        $database = function() {
20 20
             return new Database();
21 21
         };
22 22
 
23
-        $router = function () {
23
+        $router = function() {
24 24
             return new Router();
25 25
         };
26 26
 
27
-        $request = function () {
27
+        $request = function() {
28 28
             return new Request();
29 29
         };
30 30
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
     public function __get($property)
37 37
     {
38
-        if (! empty ( $this->services[$property] )) {
38
+        if (!empty ($this->services[$property])) {
39 39
             return $this->services[$property];
40 40
         }
41 41
         throw new Exception\LookupException('The service: ' . $property . ' hasn\'t been registered.');
Please login to merge, or discard this patch.