Test Failed
Branch master (51582e)
by Alexander
02:50
created
src/Route.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
      * @param Closure|null $cb
33 33
      * @param array $parameters
34 34
      */
35
-    public function __construct(string $url, ?Closure $cb = null, array $parameters = [])
35
+    public function __construct(string $url, ? Closure $cb = null, array $parameters = [])
36 36
     {
37 37
         $this->url = $url;
38 38
         $this->callback = $cb;
Please login to merge, or discard this patch.
src/data/Source.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
     public function query($query, array $params = []);
10 10
 
11
-    public function one(string $table, array $conditions, array $options = []):?array;
11
+    public function one(string $table, array $conditions, array $options = []): ? array;
12 12
 
13 13
     public function find(string $table, array $conditions, array $options = []);
14 14
 
Please login to merge, or discard this patch.
src/data/MongoDB.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         throw new \Exception("Query method is not implemented for MongDB");
79 79
     }
80 80
 
81
-    public function one(string $collection_name, array $conditions, array $options = []): ?array
81
+    public function one(string $collection_name, array $conditions, array $options = []): ? array
82 82
     {
83 83
         $collection = $this->collection($collection_name);
84 84
         $conditions = $this->idReplaceConditions($conditions);
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         return $result->getModifiedCount();
130 130
     }
131 131
 
132
-    public function insert(string $collection, array $data, array $options = []): ?ObjectID
132
+    public function insert(string $collection, array $data, array $options = []): ? ObjectID
133 133
     {
134 134
         $collection = $this->collection($collection);
135 135
         $result = $collection->insertOne($data, $options);
Please login to merge, or discard this patch.
src/data/Mysql.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         return $result->fetchAll(PDO::FETCH_ASSOC);
62 62
     }
63 63
 
64
-    public function one(string $table, array $conditions, array $options = []): ?array
64
+    public function one(string $table, array $conditions, array $options = []): ? array
65 65
     {
66 66
         $result = $this->find($table, $conditions, $options);
67 67
         $result = iterator_to_array($result);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         if (empty($conditions)) {
124 124
             return "";
125 125
         }
126
-        $fun = function ($o, $v) {
126
+        $fun = function($o, $v) {
127 127
             return "{$o}{$v} = :c_{$v}";
128 128
         };
129 129
         $where = array_reduce(array_keys($conditions), $fun, "");
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 
171 171
     private function data(array $data): string
172 172
     {
173
-        $fun = function ($o, $v) {
173
+        $fun = function($o, $v) {
174 174
             return "{$o}{$v} = :d_{$v}";
175 175
         };
176 176
         return array_reduce(array_keys($data), $fun, "");
177 177
     }
178 178
 
179
-    public function insert(string $table, array $data, array $options = []): ?int
179
+    public function insert(string $table, array $data, array $options = []): ? int
180 180
     {
181 181
         $keys = implode(', ', array_keys($data));
182 182
         $data_phs = ':d_' . implode(', :d_', array_keys($data));
Please login to merge, or discard this patch.
src/Router.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
         }
63 63
 
64 64
         // TODO cache of valid static routes, maybe with a try, catch, finally?
65
-        return new Route($url, function (Request $request) {
65
+        return new Route($url, function(Request $request) {
66 66
             return response\Page::fromRequest($request);
67 67
         });
68 68
     }
69 69
 
70
-    private static function matchDynamicRoute(string $url, string $method = Request::GET): ?Route
70
+    private static function matchDynamicRoute(string $url, string $method = Request::GET): ? Route
71 71
     {
72 72
         foreach (static::$routes[$method] as $route => $cb) {
73 73
             if ($route[0] !== substr($route, -1) || $route[0] !== static::$DELIMITER) {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
             $parameters = array_filter(
82 82
                 $matches,
83
-                function ($v) {
83
+                function($v) {
84 84
                     return !is_int($v);
85 85
                 },
86 86
                 ARRAY_FILTER_USE_KEY
Please login to merge, or discard this patch.
src/internals/debug/adapters/Html.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
             $debug->current_depth--;
53 53
             return $ret . '<li><span class="empty"> -- Blacklisted Object Avoided -- </span></li></ul>';
54 54
         }
55
-        if (isset($debug->object_references[$hash]))  {
55
+        if (isset($debug->object_references[$hash])) {
56 56
             $debug->current_depth--;
57 57
             return $ret . '<li><span class="empty"> -- Object Recursion Avoided -- </span></li></ul>';
58 58
         }
59
-        if (in_array('object', $debug->options['avoid']))  {
59
+        if (in_array('object', $debug->options['avoid'])) {
60 60
             $debug->current_depth--;
61 61
             return $ret . '<li><span class="empty"> -- Object Type Avoided -- </span></li></ul>';
62 62
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         }
77 77
         $debug->current_depth--;
78 78
         if ($props == '') return $ret .= '<li><span class="empty"> -- No properties -- </span></li></ul>';
79
-        else  $ret .=  $props;
79
+        else  $ret .= $props;
80 80
         $ret .= '</ul>';
81 81
         return  $ret;
82 82
     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             case 'string' : $length = strlen($var); $var = '\'' . htmlentities($var) . '\''; break;
110 110
             case 'NULL' : return '<span class="empty">NULL</span>'; break;
111 111
         }
112
-		$ret = '<span class="value ' . $type .'">' . $var . '</span> ';
112
+		$ret = '<span class="value ' . $type . '">' . $var . '</span> ';
113 113
 
114 114
 		if ($type == 'string') {
115 115
 			$ret .= '<span class="type">string[' . $length . ']</span>';
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
     public static function locationString(array $location) : string
123 123
     {
124 124
         extract($location);
125
-        $ret = "line: <span>$line</span> &nbsp;".
125
+        $ret = "line: <span>$line</span> &nbsp;" .
126 126
                "file: <span>$file</span> &nbsp;";
127
-        $ret .= isset($class) ? "class: <span>$class</span> &nbsp;" :'';
128
-        $ret .= isset($function) && $function != 'include' ? "function: <span>$function</span> &nbsp;" :'';
127
+        $ret .= isset($class) ? "class: <span>$class</span> &nbsp;" : '';
128
+        $ret .= isset($function) && $function != 'include' ? "function: <span>$function</span> &nbsp;" : '';
129 129
         return $ret;
130 130
     }
131 131
 
132
-    public static function top(array $outputs, ?string $key = null) : void
132
+    public static function top(array $outputs, ? string $key = null) : void
133 133
     {
134 134
             if (empty($outputs)) return;
135 135
             echo '<div id="debugger">';
Please login to merge, or discard this patch.
Braces   +16 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,9 +18,10 @@  discard block
 block discarded – undo
18 18
             $ret .= '<ul class="array">';
19 19
             if (in_array('array', $debug->options['avoid'])) {
20 20
                 $ret .= '<li><span class="empty"> -- Array Type Avoided -- </span></li>';
21
-            } else
22
-                foreach ($array as $key => $value) {
21
+            } else {
22
+                            foreach ($array as $key => $value) {
23 23
                     $ret .= '<li>[ <span class="key">' . $key . '</span> ] => ';
24
+            }
24 25
                     if (is_string($key) && in_array($key, $debug->options['blacklist']['key'])) {
25 26
                         $ret .= '<span class="empty"> -- Blacklisted Key Avoided -- </span></li>';
26 27
                         continue;
@@ -75,8 +76,11 @@  discard block
 block discarded – undo
75 76
                 $props .= self::dump_properties($reflection, $obj, $type, $rule, $debug);
76 77
         }
77 78
         $debug->current_depth--;
78
-        if ($props == '') return $ret .= '<li><span class="empty"> -- No properties -- </span></li></ul>';
79
-        else  $ret .=  $props;
79
+        if ($props == '') {
80
+            return $ret .= '<li><span class="empty"> -- No properties -- </span></li></ul>';
81
+        } else {
82
+            $ret .=  $props;
83
+        }
80 84
         $ret .= '</ul>';
81 85
         return  $ret;
82 86
     }
@@ -92,10 +96,11 @@  discard block
 block discarded – undo
92 96
             $value = $refProp->getValue($obj);
93 97
             $ret .= '<li>';
94 98
             $ret .= '<span class="access">' . $type . '</span> <span class="property">' . $property . '</span> ';
95
-            if (in_array($property, $debug->options['blacklist']['property']))
96
-                $ret .= ' : <span class="empty"> -- Blacklisted Property Avoided -- </span>';
97
-            else
98
-                $ret .= ' : ' . $debug->dump_it($value);
99
+            if (in_array($property, $debug->options['blacklist']['property'])) {
100
+                            $ret .= ' : <span class="empty"> -- Blacklisted Property Avoided -- </span>';
101
+            } else {
102
+                            $ret .= ' : ' . $debug->dump_it($value);
103
+            }
99 104
             $ret .= '</li>';
100 105
         }
101 106
         return $i ? $ret : '';
@@ -131,7 +136,9 @@  discard block
 block discarded – undo
131 136
 
132 137
     public static function top(array $outputs, ?string $key = null) : void
133 138
     {
134
-            if (empty($outputs)) return;
139
+            if (empty($outputs)) {
140
+                return;
141
+            }
135 142
             echo '<div id="debugger">';
136 143
             if ($key !== null) {
137 144
                     if (!isset($outputs[$key])) {
Please login to merge, or discard this patch.
src/internals/debug/Debug.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         switch ($mode) {
72 72
 			default :
73 73
 				$locString = \alkemann\h2l\internals\debug\adapters\Html::locationString($location);
74
-				$this->output[] = '<div class="debug-dump"><div class="debug-location">' . $locString . '</div>'.
74
+				$this->output[] = '<div class="debug-dump"><div class="debug-location">' . $locString . '</div>' .
75 75
 					'<div class="debug-content"> ' . implode("<br>\n", $dump) . '</div></div>';
76 76
 				break;
77 77
 		}
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
         while ($def = array_slice($defines, $offset--, 1)) {
140 140
             $key = key($def);
141 141
             $value = current($def);
142
-            if ($key  == 'FIRST_APP_CONSTANT') break;
143
-            $ret[$key ] = $value;
142
+            if ($key == 'FIRST_APP_CONSTANT') break;
143
+            $ret[$key] = $value;
144 144
         }
145 145
         return $ret;
146 146
     }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
     public function dump_it($var) : string
155 155
     {
156
-		$adapter = '\alkemann\h2l\internals\debug\adapters\\'. $this->options['mode'];
156
+		$adapter = '\alkemann\h2l\internals\debug\adapters\\' . $this->options['mode'];
157 157
         if (is_array($var))
158 158
             return $adapter::dump_array($var, $this);
159 159
         elseif (is_object($var))
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
     public function location($trace) : array
172 172
     {
173
-        $root = substr($_SERVER['DOCUMENT_ROOT'], 0 , strlen(static::$defaults['docroot']) * -1);
173
+        $root = substr($_SERVER['DOCUMENT_ROOT'], 0, strlen(static::$defaults['docroot']) * -1);
174 174
         $file = implode('/', array_diff(explode('/', $trace[0]['file']), explode('/', $root)));
175 175
         $ret = array(
176 176
             'file' => $file,
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
     public function trace() : array
185 185
     {
186
-        $root = substr($_SERVER['DOCUMENT_ROOT'], 0 , strlen(static::$defaults['docroot']) * -1);
186
+        $root = substr($_SERVER['DOCUMENT_ROOT'], 0, strlen(static::$defaults['docroot']) * -1);
187 187
         $trace = debug_backtrace();
188 188
         array_unshift($trace, array());
189 189
         $arr = array();
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
                 $arr[$k]['file'] = $file;
195 195
             }
196 196
             if (isset($one['line'])) $arr[$k]['line'] = $one['line'];
197
-            if (isset($one['class'])) $arr[$k-1]['class'] = $one['class'];
198
-            if (isset($one['function'])) $arr[$k-1]['function'] = $one['function'];
197
+            if (isset($one['class'])) $arr[$k - 1]['class'] = $one['class'];
198
+            if (isset($one['function'])) $arr[$k - 1]['function'] = $one['function'];
199 199
         }
200 200
         array_shift($arr);
201 201
         array_shift($arr);
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
             $obj = $var;
210 210
         } else {
211 211
             if (!class_exists($var)) {
212
-                throw new \Exception('Class ['.$var.'] doesn\'t exist');
212
+                throw new \Exception('Class [' . $var . '] doesn\'t exist');
213 213
             }
214 214
             $class = $var;
215 215
             try {
216 216
                 $obj = new $class();
217 217
             } catch (\Exception $e) {
218
-                throw new \Exception('Debug::api could not instantiate ['.$var.'], send it an object.');
218
+                throw new \Exception('Debug::api could not instantiate [' . $var . '], send it an object.');
219 219
             }
220 220
         }
221 221
         $reflection = new \ReflectionObject($obj);
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                     if (is_object($value)) {
235 235
                         $value = get_class($value);
236 236
                     } elseif (is_array($value)) {
237
-                        $value = 'array['.count($value).']';
237
+                        $value = 'array[' . count($value) . ']';
238 238
                     }
239 239
 
240 240
                     $properties[$access][$property] = compact('value', 'type');
@@ -263,12 +263,12 @@  discard block
 block discarded – undo
263 263
                     }*/
264 264
                     $method_name = $refMethod->getName();
265 265
 
266
-                    $string = $access .' function '.$method_name.'(';
266
+                    $string = $access . ' function ' . $method_name . '(';
267 267
                     $paramString = '';
268 268
                     foreach ($params as $p) {
269
-                        $paramString .= '$'.$p.', ';
269
+                        $paramString .= '$' . $p . ', ';
270 270
                     }
271
-                    $paramString  = substr($paramString,0,-2);
271
+                    $paramString = substr($paramString, 0, -2);
272 272
                     $string .= $paramString;
273 273
                     $string .= ')';
274 274
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                             $info = implode(' ', $paramArr);
289 289
                             $tags['param'][$name] = compact('type', 'info');
290 290
                         } else {
291
-                            $tags[$tagArr[0]] = isset($tagArr[1])?$tagArr[1]:'';
291
+                            $tags[$tagArr[0]] = isset($tagArr[1]) ? $tagArr[1] : '';
292 292
                         }
293 293
                     }
294 294
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
                 }
298 298
         }
299 299
 
300
-        return compact('properties', 'constants' ,'methods');
300
+        return compact('properties', 'constants', 'methods');
301 301
     }
302 302
 
303 303
 }
Please login to merge, or discard this patch.
Braces   +34 added lines, -16 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
         $this->current_depth = 0;
55 55
         $this->object_references = array();
56 56
 
57
-        if (!$options['trace']) $options['trace'] = debug_backtrace();
57
+        if (!$options['trace']) {
58
+            $options['trace'] = debug_backtrace();
59
+        }
58 60
         extract($options);
59 61
         $location = $this->location($trace);
60 62
 
@@ -65,8 +67,9 @@  discard block
 block discarded – undo
65 67
 				$dump = array_merge($dump, array($this->dump_it($one), ' - '));
66 68
 			}
67 69
 			$dump = array_slice($dump, 0, -1);
68
-        } else
69
-            $dump[] = $this->dump_it($var);
70
+        } else {
71
+                    $dump[] = $this->dump_it($var);
72
+        }
70 73
 
71 74
         switch ($mode) {
72 75
 			default :
@@ -139,7 +142,9 @@  discard block
 block discarded – undo
139 142
         while ($def = array_slice($defines, $offset--, 1)) {
140 143
             $key = key($def);
141 144
             $value = current($def);
142
-            if ($key  == 'FIRST_APP_CONSTANT') break;
145
+            if ($key  == 'FIRST_APP_CONSTANT') {
146
+                break;
147
+            }
143 148
             $ret[$key ] = $value;
144 149
         }
145 150
         return $ret;
@@ -154,12 +159,13 @@  discard block
 block discarded – undo
154 159
     public function dump_it($var) : string
155 160
     {
156 161
 		$adapter = '\alkemann\h2l\internals\debug\adapters\\'. $this->options['mode'];
157
-        if (is_array($var))
158
-            return $adapter::dump_array($var, $this);
159
-        elseif (is_object($var))
160
-            return $adapter::dump_object($var, $this);
161
-        else
162
-            return $adapter::dump_other($var);
162
+        if (is_array($var)) {
163
+                    return $adapter::dump_array($var, $this);
164
+        } elseif (is_object($var)) {
165
+                    return $adapter::dump_object($var, $this);
166
+        } else {
167
+                    return $adapter::dump_other($var);
168
+        }
163 169
     }
164 170
 
165 171
 	/**
@@ -176,8 +182,12 @@  discard block
 block discarded – undo
176 182
             'file' => $file,
177 183
             'line' => $trace[0]['line']
178 184
         );
179
-        if (isset($trace[1]['function'])) $ret['function'] = $trace[1]['function'];
180
-        if (isset($trace[1]['class'])) $ret['class'] = $trace[1]['class'];
185
+        if (isset($trace[1]['function'])) {
186
+            $ret['function'] = $trace[1]['function'];
187
+        }
188
+        if (isset($trace[1]['class'])) {
189
+            $ret['class'] = $trace[1]['class'];
190
+        }
181 191
         return $ret;
182 192
     }
183 193
 
@@ -193,9 +203,15 @@  discard block
 block discarded – undo
193 203
                 $file = implode('/', array_diff(explode('/', $one['file']), explode('/', $root)));
194 204
                 $arr[$k]['file'] = $file;
195 205
             }
196
-            if (isset($one['line'])) $arr[$k]['line'] = $one['line'];
197
-            if (isset($one['class'])) $arr[$k-1]['class'] = $one['class'];
198
-            if (isset($one['function'])) $arr[$k-1]['function'] = $one['function'];
206
+            if (isset($one['line'])) {
207
+                $arr[$k]['line'] = $one['line'];
208
+            }
209
+            if (isset($one['class'])) {
210
+                $arr[$k-1]['class'] = $one['class'];
211
+            }
212
+            if (isset($one['function'])) {
213
+                $arr[$k-1]['function'] = $one['function'];
214
+            }
199 215
         }
200 216
         array_shift($arr);
201 217
         array_shift($arr);
@@ -283,7 +299,9 @@  discard block
 block discarded – undo
283 299
                         if ($tagArr[0] == 'param') {
284 300
                             $paramArr = preg_split("/[\s\t]+/", $tagArr[1]);
285 301
                             $type = array_shift($paramArr);
286
-                            if (empty($type)) $type = array_shift($paramArr);
302
+                            if (empty($type)) {
303
+                                $type = array_shift($paramArr);
304
+                            }
287 305
                             $name = array_shift($paramArr);
288 306
                             $info = implode(' ', $paramArr);
289 307
                             $tags['param'][$name] = compact('type', 'info');
Please login to merge, or discard this patch.
src/internals/functions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     @ob_end_clean();
42 42
     $debug_trace = $debug->trace();
43 43
     foreach ($debug_trace as $t) {
44
-        @$traced[] = (empty($t['class'])?$t['file']:$t['class']).'::'.$t['function'].'::'.$t['line'];
44
+        @$traced[] = (empty($t['class']) ? $t['file'] : $t['class']) . '::' . $t['function'] . '::' . $t['line'];
45 45
     }
46 46
     $args[] = $traced;
47 47
     $debug->dump($args, compact('trace', 'split'));
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     @ob_end_clean();
78 78
     $debug_trace = $debug->trace();
79 79
     foreach ($debug_trace as $t) {
80
-        @$traced[] = (empty($t['class'])?$t['file']:$t['class']).'::'.$t['function'].'::'.$t['line'];
80
+        @$traced[] = (empty($t['class']) ? $t['file'] : $t['class']) . '::' . $t['function'] . '::' . $t['line'];
81 81
     }
82 82
     $args[] = $traced;
83 83
     $debug->dump($args, compact('trace', 'split', 'echo'));
Please login to merge, or discard this patch.
src/bootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
     if (Environment::get('debug')) {
60 60
         header("Content-type: text/html");
61 61
         echo '<h1 style="color:red;">' . $message . '</h1>';
62
-        echo '<h3>' . $file. ' :: ' . $line . '</h3>';
62
+        echo '<h3>' . $file . ' :: ' . $line . '</h3>';
63 63
         d($meta);
64 64
         die();
65 65
     } else {
Please login to merge, or discard this patch.