@@ -32,7 +32,7 @@ |
||
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; |
@@ -8,7 +8,7 @@ |
||
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 |
@@ -78,7 +78,7 @@ discard block |
||
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 |
||
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); |
@@ -61,7 +61,7 @@ discard block |
||
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 |
||
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 |
||
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)); |
@@ -62,12 +62,12 @@ discard block |
||
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 |
||
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 |
@@ -52,11 +52,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
122 | 122 | public static function locationString(array $location) : string |
123 | 123 | { |
124 | 124 | extract($location); |
125 | - $ret = "line: <span>$line</span> ". |
|
125 | + $ret = "line: <span>$line</span> " . |
|
126 | 126 | "file: <span>$file</span> "; |
127 | - $ret .= isset($class) ? "class: <span>$class</span> " :''; |
|
128 | - $ret .= isset($function) && $function != 'include' ? "function: <span>$function</span> " :''; |
|
127 | + $ret .= isset($class) ? "class: <span>$class</span> " : ''; |
|
128 | + $ret .= isset($function) && $function != 'include' ? "function: <span>$function</span> " : ''; |
|
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">'; |
@@ -71,7 +71,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | - return compact('properties', 'constants' ,'methods'); |
|
300 | + return compact('properties', 'constants', 'methods'); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | } |
@@ -41,7 +41,7 @@ discard block |
||
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 |
||
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')); |
@@ -59,7 +59,7 @@ |
||
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 { |