@@ -60,7 +60,7 @@ |
||
60 | 60 | |
61 | 61 | if (property_exists($this, 'contextualClassColorMap')) { |
62 | 62 | if (array_key_exists($class, $this->contextualClassColorMap)) { |
63 | - $this->setColor(new Color($this->contextualClassColorMap[ $class ])); |
|
63 | + $this->setColor(new Color($this->contextualClassColorMap[$class])); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function setHeaders(array $headers) |
101 | 101 | { |
102 | - $this->rows[ self::HEADER_INDEX ] = $headers; |
|
102 | + $this->rows[self::HEADER_INDEX] = $headers; |
|
103 | 103 | |
104 | 104 | return $this; |
105 | 105 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function addHeader($content = '') |
119 | 119 | { |
120 | - $this->rows[ self::HEADER_INDEX ][] = $content; |
|
120 | + $this->rows[self::HEADER_INDEX][] = $content; |
|
121 | 121 | |
122 | 122 | return $this; |
123 | 123 | } |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function getHeaders() |
135 | 135 | { |
136 | - return isset($this->rows[ self::HEADER_INDEX ]) |
|
137 | - ? $this->rows[ self::HEADER_INDEX ] |
|
136 | + return isset($this->rows[self::HEADER_INDEX]) |
|
137 | + ? $this->rows[self::HEADER_INDEX] |
|
138 | 138 | : null; |
139 | 139 | } |
140 | 140 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $this->rowIndex++; |
155 | 155 | if (is_array($data)) { |
156 | 156 | foreach ($data as $column => $content) { |
157 | - $this->rows[ $this->rowIndex ][ $column ] = $content; |
|
157 | + $this->rows[$this->rowIndex][$column] = $content; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | ? $this->rowIndex |
179 | 179 | : $rowIndex; |
180 | 180 | if ($columnIndex === null) { |
181 | - $columnIndex = isset($this->rows[ $rowIndex ]) |
|
182 | - ? count($this->rows[ $rowIndex ]) |
|
181 | + $columnIndex = isset($this->rows[$rowIndex]) |
|
182 | + ? count($this->rows[$rowIndex]) |
|
183 | 183 | : 0; |
184 | 184 | } |
185 | - $this->rows[ $rowIndex ][ $columnIndex ] = $content; |
|
185 | + $this->rows[$rowIndex][$columnIndex] = $content; |
|
186 | 186 | |
187 | 187 | return $this; |
188 | 188 | } |
@@ -282,11 +282,11 @@ discard block |
||
282 | 282 | { |
283 | 283 | foreach ($this->rows as $rowIndex => $row) { |
284 | 284 | foreach ($row as $columnIndex => $column) { |
285 | - if ( ! isset($this->columnWidths[ $columnIndex ])) { |
|
286 | - $this->columnWidths[ $columnIndex ] = strlen($column); |
|
285 | + if ( ! isset($this->columnWidths[$columnIndex])) { |
|
286 | + $this->columnWidths[$columnIndex] = strlen($column); |
|
287 | 287 | } else { |
288 | - if (strlen($column) > $this->columnWidths[ $columnIndex ]) { |
|
289 | - $this->columnWidths[ $columnIndex ] = strlen($column); |
|
288 | + if (strlen($column) > $this->columnWidths[$columnIndex]) { |
|
289 | + $this->columnWidths[$columnIndex] = strlen($column); |
|
290 | 290 | } |
291 | 291 | } |
292 | 292 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | private function renderBorder() |
308 | 308 | { |
309 | 309 | $output = ''; |
310 | - $columnCount = count($this->rows[ 0 ]); |
|
310 | + $columnCount = count($this->rows[0]); |
|
311 | 311 | for ($col = 0; $col < $columnCount; $col++) { |
312 | 312 | $output .= $this->renderCell($col); |
313 | 313 | } |
@@ -334,9 +334,9 @@ discard block |
||
334 | 334 | private function renderCell($index, $row = null) |
335 | 335 | { |
336 | 336 | $cell = $row |
337 | - ? $row[ $index ] |
|
337 | + ? $row[$index] |
|
338 | 338 | : '-'; |
339 | - $width = $this->columnWidths[ $index ]; |
|
339 | + $width = $this->columnWidths[$index]; |
|
340 | 340 | $pad = $row |
341 | 341 | ? $width - strlen($cell) |
342 | 342 | : $width; |
@@ -153,7 +153,7 @@ |
||
153 | 153 | $lines = []; |
154 | 154 | |
155 | 155 | for ($i = 0; $i < $this->numbers; $i++) { |
156 | - $lines[ $i ] = $this->color->paint(str_repeat($this->string, $this->width)); |
|
156 | + $lines[$i] = $this->color->paint(str_repeat($this->string, $this->width)); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | return str_repeat(PHP_EOL, $this->newLinesBefore) . implode(PHP_EOL, $lines) . str_repeat(PHP_EOL, |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | return; |
58 | 58 | } |
59 | 59 | |
60 | - $_POST[ $name ] = $standardInput; |
|
60 | + $_POST[$name] = $standardInput; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // ------------------------------------------------------------------------ |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | return; |
98 | 98 | } |
99 | 99 | |
100 | - $_POST[ $name ] = (bool)($standardInput === 'Y'); |
|
100 | + $_POST[$name] = (bool)($standardInput === 'Y'); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // ------------------------------------------------------------------------ |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $choices = []; |
120 | 120 | $i = 1; |
121 | 121 | foreach ($options as $value => $label) { |
122 | - $choices[ $i ] = $value; |
|
122 | + $choices[$i] = $value; |
|
123 | 123 | output()->write( |
124 | 124 | (new Format()) |
125 | 125 | ->setString('(' . $i . ') ' . language()->getLine($label)) |
@@ -166,6 +166,6 @@ discard block |
||
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | - $_POST[ $name ] = $choices[ $standardInput ]; |
|
169 | + $_POST[$name] = $choices[$standardInput]; |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | \ No newline at end of file |
@@ -161,12 +161,12 @@ |
||
161 | 161 | |
162 | 162 | // set foreground color |
163 | 163 | if (array_key_exists($this->foreground, $this->foregroundColors)) { |
164 | - $coloredString .= "\033[" . $this->foregroundColors[ $this->foreground ] . "m"; |
|
164 | + $coloredString .= "\033[" . $this->foregroundColors[$this->foreground] . "m"; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // set background color |
168 | 168 | if (array_key_exists($this->background, $this->backgroundColors)) { |
169 | - $coloredString .= "\033[" . $this->backgroundColors[ $this->background ] . "m"; |
|
169 | + $coloredString .= "\033[" . $this->backgroundColors[$this->background] . "m"; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | // combine with string and end the painting |
@@ -93,7 +93,7 @@ |
||
93 | 93 | $commander->setApp($this); |
94 | 94 | } |
95 | 95 | |
96 | - $this->commandersPool[ $commander->getCommandName() ] = $commander; |
|
96 | + $this->commandersPool[$commander->getCommandName()] = $commander; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | // ------------------------------------------------------------------------ |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function parseRequest() |
64 | 64 | { |
65 | - $argv = $_SERVER[ 'argv' ]; |
|
65 | + $argv = $_SERVER['argv']; |
|
66 | 66 | |
67 | - if ($_SERVER[ 'SCRIPT_NAME' ] === $_SERVER[ 'argv' ][ 0 ]) { |
|
67 | + if ($_SERVER['SCRIPT_NAME'] === $_SERVER['argv'][0]) { |
|
68 | 68 | array_shift($argv); |
69 | 69 | |
70 | 70 | if (empty($argv)) { |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | - $this->string = str_replace(['/', '\\', ':'], '/', $argv[ 0 ]); |
|
75 | + $this->string = str_replace(['/', '\\', ':'], '/', $argv[0]); |
|
76 | 76 | $this->segments = explode('/', $this->string); |
77 | 77 | |
78 | - if (strpos($this->segments[ 0 ], '--') !== false |
|
79 | - || strpos($this->segments[ 0 ], '-') !== false |
|
78 | + if (strpos($this->segments[0], '--') !== false |
|
79 | + || strpos($this->segments[0], '-') !== false |
|
80 | 80 | ) { |
81 | 81 | $options = $this->segments; |
82 | 82 | $this->segments = []; |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | |
96 | 96 | if (strpos($option, '=') !== false) { |
97 | 97 | $optionParts = explode('=', $option); |
98 | - $option = $optionParts[ 0 ]; |
|
99 | - $value = $optionParts[ 1 ]; |
|
98 | + $option = $optionParts[0]; |
|
99 | + $value = $optionParts[1]; |
|
100 | 100 | } else { |
101 | 101 | $value = current($options); |
102 | 102 | } |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | if (strpos($value, '--') === false |
111 | 111 | || strpos($value, '-') === false |
112 | 112 | ) { |
113 | - $_GET[ $option ] = $value; |
|
113 | + $_GET[$option] = $value; |
|
114 | 114 | } else { |
115 | - $_GET[ $option ] = null; |
|
115 | + $_GET[$option] = null; |
|
116 | 116 | } |
117 | 117 | } else { |
118 | 118 | $keys = array_keys($_GET); |
119 | - if(count($keys)) { |
|
119 | + if (count($keys)) { |
|
120 | 120 | $key = end($keys); |
121 | 121 | $_GET[$key] = $option; |
122 | 122 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | if (array_key_exists('verbose', $_GET) or array_key_exists('v', $_GET)) { |
127 | - $_ENV[ 'VERBOSE' ] = true; |
|
127 | + $_ENV['VERBOSE'] = true; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $this->parseSegments($this->segments); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $loopThrough = []; |
107 | 107 | |
108 | 108 | foreach ($offset as $key) { |
109 | - $loopThrough[ $key ] = $this->filter($type, $key, $filter); |
|
109 | + $loopThrough[$key] = $this->filter($type, $key, $filter); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | if (empty($loopThrough)) { |
@@ -120,38 +120,38 @@ discard block |
||
120 | 120 | // of the simpler filter_input(); |
121 | 121 | switch ($type) { |
122 | 122 | case INPUT_GET: |
123 | - $value = isset($_GET[ $offset ]) |
|
124 | - ? $_GET[ $offset ] |
|
123 | + $value = isset($_GET[$offset]) |
|
124 | + ? $_GET[$offset] |
|
125 | 125 | : null; |
126 | 126 | break; |
127 | 127 | case INPUT_POST: |
128 | - $value = isset($_POST[ $offset ]) |
|
129 | - ? $_POST[ $offset ] |
|
128 | + $value = isset($_POST[$offset]) |
|
129 | + ? $_POST[$offset] |
|
130 | 130 | : null; |
131 | 131 | break; |
132 | 132 | case INPUT_SERVER: |
133 | - $value = isset($_SERVER[ $offset ]) |
|
134 | - ? $_SERVER[ $offset ] |
|
133 | + $value = isset($_SERVER[$offset]) |
|
134 | + ? $_SERVER[$offset] |
|
135 | 135 | : null; |
136 | 136 | break; |
137 | 137 | case INPUT_ENV: |
138 | - $value = isset($_ENV[ $offset ]) |
|
139 | - ? $_ENV[ $offset ] |
|
138 | + $value = isset($_ENV[$offset]) |
|
139 | + ? $_ENV[$offset] |
|
140 | 140 | : null; |
141 | 141 | break; |
142 | 142 | case INPUT_COOKIE: |
143 | - $value = isset($_COOKIE[ $offset ]) |
|
144 | - ? $_COOKIE[ $offset ] |
|
143 | + $value = isset($_COOKIE[$offset]) |
|
144 | + ? $_COOKIE[$offset] |
|
145 | 145 | : null; |
146 | 146 | break; |
147 | 147 | case INPUT_REQUEST: |
148 | - $value = isset($_REQUEST[ $offset ]) |
|
149 | - ? $_REQUEST[ $offset ] |
|
148 | + $value = isset($_REQUEST[$offset]) |
|
149 | + ? $_REQUEST[$offset] |
|
150 | 150 | : null; |
151 | 151 | break; |
152 | 152 | case INPUT_SESSION: |
153 | - $value = isset($_SESSION[ $offset ]) |
|
154 | - ? $_SESSION[ $offset ] |
|
153 | + $value = isset($_SESSION[$offset]) |
|
154 | + ? $_SESSION[$offset] |
|
155 | 155 | : null; |
156 | 156 | break; |
157 | 157 | default: |
@@ -210,13 +210,13 @@ discard block |
||
210 | 210 | { |
211 | 211 | foreach ($data as $key => $value) { |
212 | 212 | if (is_array($value) AND is_array($filter)) { |
213 | - $data[ $key ] = filter_var_array($value, $filter); |
|
213 | + $data[$key] = filter_var_array($value, $filter); |
|
214 | 214 | } elseif (is_array($value)) { |
215 | - $data[ $key ] = $this->filterRecursive($value, $filter); |
|
215 | + $data[$key] = $this->filterRecursive($value, $filter); |
|
216 | 216 | } elseif (isset($filter)) { |
217 | - $data[ $key ] = filter_var($value, $filter); |
|
217 | + $data[$key] = filter_var($value, $filter); |
|
218 | 218 | } else { |
219 | - $data[ $key ] = $value; |
|
219 | + $data[$key] = $value; |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | */ |
261 | 261 | final public function argv($offset = null, $filter = null) |
262 | 262 | { |
263 | - $arguments = $_SERVER[ 'argv' ]; |
|
264 | - $numArguments = $_SERVER[ 'argc' ]; |
|
263 | + $arguments = $_SERVER['argv']; |
|
264 | + $numArguments = $_SERVER['argc']; |
|
265 | 265 | |
266 | 266 | $argv = []; |
267 | 267 | for ($i = 1; $i < $numArguments; $i++) { |
268 | - $optionCommand = trim($arguments[ $i ]); |
|
268 | + $optionCommand = trim($arguments[$i]); |
|
269 | 269 | $optionValue = true; |
270 | 270 | |
271 | 271 | if (empty($optionCommand)) { |
@@ -276,10 +276,10 @@ discard block |
||
276 | 276 | $xOptionCommand = explode('=', $optionCommand); |
277 | 277 | $xOptionCommand = array_map('trim', $xOptionCommand); |
278 | 278 | |
279 | - $optionCommand = str_replace(['-', '--'], '', $xOptionCommand[ 0 ]); |
|
280 | - $optionValue = $xOptionCommand[ 1 ]; |
|
279 | + $optionCommand = str_replace(['-', '--'], '', $xOptionCommand[0]); |
|
280 | + $optionValue = $xOptionCommand[1]; |
|
281 | 281 | |
282 | - $argv[ $optionCommand ] = $optionValue; |
|
282 | + $argv[$optionCommand] = $optionValue; |
|
283 | 283 | continue; |
284 | 284 | } |
285 | 285 | |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | ) { |
289 | 289 | $optionCommand = str_replace(['-', '--'], '', $optionCommand); |
290 | 290 | |
291 | - if (isset($arguments[ $i + 1 ])) { |
|
292 | - $nextOptionCommand = $arguments[ $i + 1 ]; |
|
291 | + if (isset($arguments[$i + 1])) { |
|
292 | + $nextOptionCommand = $arguments[$i + 1]; |
|
293 | 293 | |
294 | 294 | if (strpos($nextOptionCommand, '--') === false |
295 | 295 | || strpos($nextOptionCommand, '-') === false |
296 | 296 | ) { |
297 | 297 | $optionValue = $nextOptionCommand; |
298 | - $arguments[ $i + 1 ] = null; |
|
298 | + $arguments[$i + 1] = null; |
|
299 | 299 | } |
300 | 300 | } |
301 | 301 | } |
@@ -306,13 +306,13 @@ discard block |
||
306 | 306 | $optionValue = filter_var($optionValue, FILTER_DEFAULT); |
307 | 307 | } |
308 | 308 | |
309 | - $argv[ $optionCommand ] = $optionValue; |
|
309 | + $argv[$optionCommand] = $optionValue; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | if (empty($offset)) { |
313 | 313 | return $argv; |
314 | - } elseif (isset($argv[ $offset ])) { |
|
315 | - return $argv[ $offset ]; |
|
314 | + } elseif (isset($argv[$offset])) { |
|
315 | + return $argv[$offset]; |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | |
328 | 328 | public function getApp() |
329 | 329 | { |
330 | - return isset($_SERVER[ 'argv' ][ 0 ]) |
|
331 | - ? $_SERVER[ 'argv' ][ 0 ] |
|
330 | + return isset($_SERVER['argv'][0]) |
|
331 | + ? $_SERVER['argv'][0] |
|
332 | 332 | : false; |
333 | 333 | } |
334 | 334 | |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | |
337 | 337 | public function getCommand() |
338 | 338 | { |
339 | - return isset($_SERVER[ 'argv' ][ 1 ]) |
|
340 | - ? $_SERVER[ 'argv' ][ 1 ] |
|
339 | + return isset($_SERVER['argv'][1]) |
|
340 | + ? $_SERVER['argv'][1] |
|
341 | 341 | : false; |
342 | 342 | } |
343 | 343 | |
@@ -345,13 +345,13 @@ discard block |
||
345 | 345 | |
346 | 346 | public function getOptions($offset = null, $filter = null) |
347 | 347 | { |
348 | - $arguments = $_SERVER[ 'argv' ]; |
|
349 | - $numArguments = $_SERVER[ 'argc' ]; |
|
348 | + $arguments = $_SERVER['argv']; |
|
349 | + $numArguments = $_SERVER['argc']; |
|
350 | 350 | |
351 | 351 | $argv = []; |
352 | 352 | |
353 | 353 | for ($i = 2; $i < $numArguments; $i++) { |
354 | - $optionCommand = trim($arguments[ $i ]); |
|
354 | + $optionCommand = trim($arguments[$i]); |
|
355 | 355 | $optionValue = true; |
356 | 356 | |
357 | 357 | if (empty($optionCommand)) { |
@@ -362,10 +362,10 @@ discard block |
||
362 | 362 | $xOptionCommand = explode('=', $optionCommand); |
363 | 363 | $xOptionCommand = array_map('trim', $xOptionCommand); |
364 | 364 | |
365 | - $optionCommand = str_replace(['-', '--'], '', $xOptionCommand[ 0 ]); |
|
366 | - $optionValue = $xOptionCommand[ 1 ]; |
|
365 | + $optionCommand = str_replace(['-', '--'], '', $xOptionCommand[0]); |
|
366 | + $optionValue = $xOptionCommand[1]; |
|
367 | 367 | |
368 | - $argv[ $optionCommand ] = $optionValue; |
|
368 | + $argv[$optionCommand] = $optionValue; |
|
369 | 369 | continue; |
370 | 370 | } |
371 | 371 | |
@@ -374,14 +374,14 @@ discard block |
||
374 | 374 | ) { |
375 | 375 | $optionCommand = str_replace(['-', '--'], '', $optionCommand); |
376 | 376 | |
377 | - if (isset($arguments[ $i + 1 ])) { |
|
378 | - $nextOptionCommand = $arguments[ $i + 1 ]; |
|
377 | + if (isset($arguments[$i + 1])) { |
|
378 | + $nextOptionCommand = $arguments[$i + 1]; |
|
379 | 379 | |
380 | 380 | if (strpos($nextOptionCommand, '--') === false |
381 | 381 | || strpos($nextOptionCommand, '-') === false |
382 | 382 | ) { |
383 | 383 | $optionValue = $nextOptionCommand; |
384 | - $arguments[ $i + 1 ] = null; |
|
384 | + $arguments[$i + 1] = null; |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | } |
@@ -392,13 +392,13 @@ discard block |
||
392 | 392 | $optionValue = filter_var($optionValue, FILTER_DEFAULT); |
393 | 393 | } |
394 | 394 | |
395 | - $argv[ $optionCommand ] = $optionValue; |
|
395 | + $argv[$optionCommand] = $optionValue; |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | if (empty($offset)) { |
399 | 399 | return $argv; |
400 | - } elseif (isset($argv[ $offset ])) { |
|
401 | - return $argv[ $offset ]; |
|
400 | + } elseif (isset($argv[$offset])) { |
|
401 | + return $argv[$offset]; |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * @param $className |
26 | 26 | */ |
27 | 27 | spl_autoload_register( |
28 | - function ($className) { |
|
28 | + function($className) { |
|
29 | 29 | if ($className === 'O2System\Kernel') { |
30 | 30 | require __DIR__ . DIRECTORY_SEPARATOR . 'Kernel.php'; |
31 | 31 | } elseif (strpos($className, 'O2System\Kernel\\') === false) { |