@@ -155,7 +155,7 @@ |
||
| 155 | 155 | { |
| 156 | 156 | $arguments = array_values($arguments); |
| 157 | 157 | array_unshift($arguments, null); |
| 158 | - unset($arguments[ 0 ]); |
|
| 158 | + unset($arguments[0]); |
|
| 159 | 159 | |
| 160 | 160 | $this->requestMethodArgs = $arguments; |
| 161 | 161 | |
@@ -155,7 +155,7 @@ |
||
| 155 | 155 | { |
| 156 | 156 | $arguments = array_values($arguments); |
| 157 | 157 | array_unshift($arguments, null); |
| 158 | - unset($arguments[ 0 ]); |
|
| 158 | + unset($arguments[0]); |
|
| 159 | 159 | |
| 160 | 160 | $this->requestMethodArgs = $arguments; |
| 161 | 161 | |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | $this->path = $path; |
| 85 | 85 | $this->closure = $closure; |
| 86 | 86 | $this->domain = is_null($domain) |
| 87 | - ? isset($_SERVER[ 'HTTP_HOST' ]) |
|
| 88 | - ? @$_SERVER[ 'HTTP_HOST' ] |
|
| 89 | - : @$_SERVER[ 'SERVER_NAME' ] |
|
| 87 | + ? isset($_SERVER['HTTP_HOST']) |
|
| 88 | + ? @$_SERVER['HTTP_HOST'] |
|
| 89 | + : @$_SERVER['SERVER_NAME'] |
|
| 90 | 90 | : $domain; |
| 91 | 91 | |
| 92 | 92 | // Remove www |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | if (preg_match_all("/{(.*)}/", $this->domain, $matches)) { |
| 98 | - foreach ($matches[ 1 ] as $match) { |
|
| 98 | + foreach ($matches[1] as $match) { |
|
| 99 | 99 | $this->closureParameters[] = $match; |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function isValidDomain() |
| 204 | 204 | { |
| 205 | - $domain = isset($_SERVER[ 'HTTP_HOST' ]) |
|
| 206 | - ? $_SERVER[ 'HTTP_HOST' ] |
|
| 207 | - : $_SERVER[ 'SERVER_NAME' ]; |
|
| 205 | + $domain = isset($_SERVER['HTTP_HOST']) |
|
| 206 | + ? $_SERVER['HTTP_HOST'] |
|
| 207 | + : $_SERVER['SERVER_NAME']; |
|
| 208 | 208 | |
| 209 | 209 | if ($this->domain === $domain) { |
| 210 | 210 | return true; |
@@ -243,22 +243,22 @@ discard block |
||
| 243 | 243 | if (($class = $parameter->getClass()) instanceof \ReflectionClass) { |
| 244 | 244 | $className = $class->getName(); |
| 245 | 245 | if (class_exists($className)) { |
| 246 | - if (isset($matches[ $parameter->name ])) { |
|
| 247 | - $parameters[ $index ] = new $className($matches[ $parameter->name ]); |
|
| 246 | + if (isset($matches[$parameter->name])) { |
|
| 247 | + $parameters[$index] = new $className($matches[$parameter->name]); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | - } elseif (isset($matches[ $parameter->name ])) { |
|
| 251 | - $parameters[ $index ] = $matches[ $parameter->name ]; |
|
| 250 | + } elseif (isset($matches[$parameter->name])) { |
|
| 251 | + $parameters[$index] = $matches[$parameter->name]; |
|
| 252 | 252 | } else { |
| 253 | - $parameters[ $index ] = null; |
|
| 253 | + $parameters[$index] = null; |
|
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | } else { |
| 257 | 257 | foreach ($closure->getParameters() as $index => $parameter) { |
| 258 | - if (isset($matches[ $index ])) { |
|
| 259 | - $parameters[ $index ] = $matches[ $index ]; |
|
| 258 | + if (isset($matches[$index])) { |
|
| 259 | + $parameters[$index] = $matches[$index]; |
|
| 260 | 260 | } else { |
| 261 | - $parameters[ $index ] = null; |
|
| 261 | + $parameters[$index] = null; |
|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | } |
@@ -310,16 +310,16 @@ discard block |
||
| 310 | 310 | $parameters = []; |
| 311 | 311 | |
| 312 | 312 | for ($i = 0; $i <= count($pathParts); $i++) { |
| 313 | - if (isset($pathParts[ $i ]) && isset($stringParts[ $i ])) { |
|
| 314 | - if ($pathParts[ $i ] == $stringParts[ $i ]) { |
|
| 315 | - $matches[ $i ] = $stringParts[ $i ]; |
|
| 313 | + if (isset($pathParts[$i]) && isset($stringParts[$i])) { |
|
| 314 | + if ($pathParts[$i] == $stringParts[$i]) { |
|
| 315 | + $matches[$i] = $stringParts[$i]; |
|
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - if (isset($pathParts[ $i ])) { |
|
| 320 | - if (preg_match("/{(.*)}/", $pathParts[ $i ])) { |
|
| 321 | - $index = str_replace(['{$', '}'], '', $pathParts[ $i ]); |
|
| 322 | - $parameters[ $index ] = isset($stringParts[ $i ]) ? $stringParts[ $i ] : null; |
|
| 319 | + if (isset($pathParts[$i])) { |
|
| 320 | + if (preg_match("/{(.*)}/", $pathParts[$i])) { |
|
| 321 | + $index = str_replace(['{$', '}'], '', $pathParts[$i]); |
|
| 322 | + $parameters[$index] = isset($stringParts[$i]) ? $stringParts[$i] : null; |
|
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | } |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $service = new SplServiceRegistry($serviceClassName); |
| 64 | 64 | } elseif (class_exists($serviceClassName = 'O2System\Kernel\\' . $className)) { |
| 65 | 65 | $service = new SplServiceRegistry($serviceClassName); |
| 66 | - } elseif(class_exists($className)) { |
|
| 66 | + } elseif (class_exists($className)) { |
|
| 67 | 67 | $service = new SplServiceRegistry($serviceClassName); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $whoops = new \Whoops\Run(); |
| 83 | 83 | |
| 84 | 84 | if (is_ajax() or $this->mimeType === 'application/json' or $this->mimeType === 'application/xml') { |
| 85 | - $whoops->pushHandler(new CallbackHandler(function ($error) { |
|
| 85 | + $whoops->pushHandler(new CallbackHandler(function($error) { |
|
| 86 | 86 | $this->send([ |
| 87 | 87 | 'status' => 500, |
| 88 | 88 | 'success' => false, |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | if (is_array($lastError)) { |
| 125 | 125 | $this->errorHandler( |
| 126 | - $lastError[ 'type' ], |
|
| 127 | - $lastError[ 'message' ], |
|
| 128 | - $lastError[ 'file' ], |
|
| 129 | - $lastError[ 'line' ] |
|
| 126 | + $lastError['type'], |
|
| 127 | + $lastError['message'], |
|
| 128 | + $lastError['file'], |
|
| 129 | + $lastError['line'] |
|
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -257,8 +257,8 @@ discard block |
||
| 257 | 257 | if (strpos($mimeType, '/') === false) { |
| 258 | 258 | $extension = ltrim($mimeType, '.'); |
| 259 | 259 | // Is this extension supported? |
| 260 | - if (isset($mimes[ $extension ])) { |
|
| 261 | - $mimeType =& $mimes[ $extension ]; |
|
| 260 | + if (isset($mimes[$extension])) { |
|
| 261 | + $mimeType = & $mimes[$extension]; |
|
| 262 | 262 | if (is_array($mimeType)) { |
| 263 | 263 | $mimeType = current($mimeType); |
| 264 | 264 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | public function addHeader($name, $value) |
| 290 | 290 | { |
| 291 | - $this->headers[ $name ] = $value; |
|
| 291 | + $this->headers[$name] = $value; |
|
| 292 | 292 | |
| 293 | 293 | return $this; |
| 294 | 294 | } |
@@ -312,56 +312,56 @@ discard block |
||
| 312 | 312 | ]; |
| 313 | 313 | |
| 314 | 314 | if (is_array($data)) { |
| 315 | - if (isset($data[ 'status' ])) { |
|
| 316 | - $response[ 'status' ] = $statusCode = $data[ 'status' ]; |
|
| 317 | - unset($data[ 'status' ]); |
|
| 315 | + if (isset($data['status'])) { |
|
| 316 | + $response['status'] = $statusCode = $data['status']; |
|
| 317 | + unset($data['status']); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if (isset($data[ 'reason' ])) { |
|
| 321 | - $response[ 'reason' ] = $reasonPhrase = $data[ 'reason' ]; |
|
| 322 | - unset($data[ 'reason' ]); |
|
| 320 | + if (isset($data['reason'])) { |
|
| 321 | + $response['reason'] = $reasonPhrase = $data['reason']; |
|
| 322 | + unset($data['reason']); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - if (isset($data[ 'success' ])) { |
|
| 326 | - $response[ 'success' ] = $data[ 'success' ]; |
|
| 327 | - unset($data[ 'success' ]); |
|
| 325 | + if (isset($data['success'])) { |
|
| 326 | + $response['success'] = $data['success']; |
|
| 327 | + unset($data['success']); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if (isset($data[ 'message' ])) { |
|
| 331 | - $response[ 'message' ] = $data[ 'message' ]; |
|
| 332 | - unset($data[ 'message' ]); |
|
| 330 | + if (isset($data['message'])) { |
|
| 331 | + $response['message'] = $data['message']; |
|
| 332 | + unset($data['message']); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - if (isset($data[ 'metadata' ])) { |
|
| 336 | - $response[ 'metadata' ] = $data[ 'metadata' ]; |
|
| 337 | - unset($data[ 'metadata' ]); |
|
| 335 | + if (isset($data['metadata'])) { |
|
| 336 | + $response['metadata'] = $data['metadata']; |
|
| 337 | + unset($data['metadata']); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if (isset($data[ 'result' ])) { |
|
| 341 | - $data = $data[ 'result' ]; |
|
| 340 | + if (isset($data['result'])) { |
|
| 341 | + $data = $data['result']; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if (isset($data[ 'data' ])) { |
|
| 345 | - $data = $data[ 'data' ]; |
|
| 344 | + if (isset($data['data'])) { |
|
| 345 | + $data = $data['data']; |
|
| 346 | 346 | } |
| 347 | 347 | } elseif (is_object($data)) { |
| 348 | 348 | if (isset($data->status)) { |
| 349 | - $response[ 'status' ] = $statusCode = $data->status; |
|
| 349 | + $response['status'] = $statusCode = $data->status; |
|
| 350 | 350 | unset($data->status); |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | if (isset($data->reason)) { |
| 354 | - $response[ 'reason' ] = $reasonPhrase = $data->reason; |
|
| 354 | + $response['reason'] = $reasonPhrase = $data->reason; |
|
| 355 | 355 | unset($data->reason); |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | if (isset($data->success)) { |
| 359 | - $response[ 'success' ] = $data->success; |
|
| 359 | + $response['success'] = $data->success; |
|
| 360 | 360 | unset($data->success); |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | if (isset($data->message)) { |
| 364 | - $response[ 'message' ] = $data->message; |
|
| 364 | + $response['message'] = $data->message; |
|
| 365 | 365 | unset($data->message); |
| 366 | 366 | } |
| 367 | 367 | |
@@ -388,16 +388,16 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | if (is_array($data)) { |
| 390 | 390 | if (is_string(key($data))) { |
| 391 | - $response[ 'result' ] = [$data]; |
|
| 391 | + $response['result'] = [$data]; |
|
| 392 | 392 | } elseif (is_numeric(key($data))) { |
| 393 | - $response[ 'result' ] = $data; |
|
| 393 | + $response['result'] = $data; |
|
| 394 | 394 | } |
| 395 | 395 | } else { |
| 396 | - $response[ 'result' ] = $data; |
|
| 396 | + $response['result'] = $data; |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | if (is_ajax()) { |
| 400 | - $contentType = isset($_SERVER[ 'HTTP_X_REQUESTED_CONTENT_TYPE' ]) ? $_SERVER[ 'HTTP_X_REQUESTED_CONTENT_TYPE' ] : 'application/json'; |
|
| 400 | + $contentType = isset($_SERVER['HTTP_X_REQUESTED_CONTENT_TYPE']) ? $_SERVER['HTTP_X_REQUESTED_CONTENT_TYPE'] : 'application/json'; |
|
| 401 | 401 | $this->setContentType($contentType); |
| 402 | 402 | } |
| 403 | 403 | |
@@ -410,12 +410,12 @@ discard block |
||
| 410 | 410 | $this->arrayToXml($response, $xml); |
| 411 | 411 | |
| 412 | 412 | echo $xml->asXML(); |
| 413 | - } elseif(is_cli()) { |
|
| 413 | + } elseif (is_cli()) { |
|
| 414 | 414 | print_cli($response, true); |
| 415 | - } elseif(is_array($response['result'])) { |
|
| 415 | + } elseif (is_array($response['result'])) { |
|
| 416 | 416 | print_r($response['result']); |
| 417 | 417 | } else { |
| 418 | - echo $response[ 'result' ]; |
|
| 418 | + echo $response['result']; |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | |
@@ -434,8 +434,8 @@ discard block |
||
| 434 | 434 | foreach (headers_list() as $header) { |
| 435 | 435 | $headerParts = explode(':', $header); |
| 436 | 436 | $headerParts = array_map('trim', $headerParts); |
| 437 | - $headers[ $headerParts[ 0 ] ] = $headerParts[ 1 ]; |
|
| 438 | - header_remove($header[ 0 ]); |
|
| 437 | + $headers[$headerParts[0]] = $headerParts[1]; |
|
| 438 | + header_remove($header[0]); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | if (count($headers)) { |
@@ -561,21 +561,21 @@ discard block |
||
| 561 | 561 | ]; |
| 562 | 562 | |
| 563 | 563 | $this->statusCode = $code; |
| 564 | - $this->reasonPhrase = $error[ 'title' ]; |
|
| 564 | + $this->reasonPhrase = $error['title']; |
|
| 565 | 565 | |
| 566 | 566 | if (is_string($vars)) { |
| 567 | 567 | $vars = ['message' => $vars]; |
| 568 | - } elseif (is_array($vars) and empty($vars[ 'message' ])) { |
|
| 569 | - $vars[ 'message' ] = $error[ 'message' ]; |
|
| 568 | + } elseif (is_array($vars) and empty($vars['message'])) { |
|
| 569 | + $vars['message'] = $error['message']; |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | - if (isset($vars[ 'message' ])) { |
|
| 573 | - $error[ 'message' ] = $vars[ 'message' ]; |
|
| 572 | + if (isset($vars['message'])) { |
|
| 573 | + $error['message'] = $vars['message']; |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | if (is_ajax() or $this->mimeType !== 'text/html') { |
| 577 | 577 | $this->statusCode = $code; |
| 578 | - $this->reasonPhrase = $error[ 'title' ]; |
|
| 578 | + $this->reasonPhrase = $error['title']; |
|
| 579 | 579 | $this->send($vars); |
| 580 | 580 | |
| 581 | 581 | exit(EXIT_ERROR); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | if (count($this->loaded)) { |
| 108 | 108 | foreach ($this->loaded as $fileIndex => $filePath) { |
| 109 | - unset($this->loaded[ $fileIndex ]); |
|
| 109 | + unset($this->loaded[$fileIndex]); |
|
| 110 | 110 | $this->loadFile($fileIndex); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | if (is_array($lines)) { |
| 218 | 218 | if (count($lines)) { |
| 219 | - $this->loaded[ $this->getFileIndex($filePath) ] = $filePath; |
|
| 219 | + $this->loaded[$this->getFileIndex($filePath)] = $filePath; |
|
| 220 | 220 | |
| 221 | 221 | $this->lines = array_merge($this->lines, $lines); |
| 222 | 222 | |
@@ -346,9 +346,9 @@ discard block |
||
| 346 | 346 | $lineOffset = strtoupper($line); |
| 347 | 347 | |
| 348 | 348 | if (empty($context)) { |
| 349 | - $lineContent = isset($this->lines[ $lineOffset ]) ? $this->lines[ $lineOffset ] : $line; |
|
| 349 | + $lineContent = isset($this->lines[$lineOffset]) ? $this->lines[$lineOffset] : $line; |
|
| 350 | 350 | } else { |
| 351 | - $line = isset($this->lines[ $lineOffset ]) ? $this->lines[ $lineOffset ] : $line; |
|
| 351 | + $line = isset($this->lines[$lineOffset]) ? $this->lines[$lineOffset] : $line; |
|
| 352 | 352 | array_unshift($context, $line); |
| 353 | 353 | |
| 354 | 354 | $lineContent = @call_user_func_array('sprintf', $context); |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $this->services = new Kernel\Containers\Services(); |
| 57 | 57 | |
| 58 | - if (isset($_ENV[ 'DEBUG_STAGE' ]) and $_ENV[ 'DEBUG_STAGE' ] === 'DEVELOPER') { |
|
| 59 | - if(class_exists('\O2System\Gear\Profiler')) { |
|
| 58 | + if (isset($_ENV['DEBUG_STAGE']) and $_ENV['DEBUG_STAGE'] === 'DEVELOPER') { |
|
| 59 | + if (class_exists('\O2System\Gear\Profiler')) { |
|
| 60 | 60 | $this->services->load(Gear\Profiler::class); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -150,14 +150,14 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function &__get($property) |
| 152 | 152 | { |
| 153 | - $get[ $property ] = null; |
|
| 153 | + $get[$property] = null; |
|
| 154 | 154 | |
| 155 | 155 | if (isset($this->{$property})) { |
| 156 | - $get[ $property ] =& $this->{$property}; |
|
| 156 | + $get[$property] = & $this->{$property}; |
|
| 157 | 157 | } elseif ($this->services->has($property)) { |
| 158 | - $get[ $property ] = $this->services->get($property); |
|
| 158 | + $get[$property] = $this->services->get($property); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - return $get[ $property ]; |
|
| 161 | + return $get[$property]; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | \ No newline at end of file |
@@ -103,17 +103,17 @@ discard block |
||
| 103 | 103 | $this->commandName = implode('/', array_map('strtolower', explode('/', $className))); |
| 104 | 104 | |
| 105 | 105 | foreach ($this->commandOptions as $optionName => $optionConfig) { |
| 106 | - $shortcut = empty($optionConfig[ 'shortcut' ]) |
|
| 106 | + $shortcut = empty($optionConfig['shortcut']) |
|
| 107 | 107 | ? '-' . substr($optionName, 0, 1) |
| 108 | - : '-' . rtrim($optionConfig[ 'shortcut' ]); |
|
| 108 | + : '-' . rtrim($optionConfig['shortcut']); |
|
| 109 | 109 | |
| 110 | 110 | if (array_key_exists($shortcut, $this->commandOptionsShortcuts)) { |
| 111 | 111 | $shortcut = '-' . substr($optionName, 0, 2); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - $this->commandOptions[ $optionName ][ 'shortcut' ] = $shortcut; |
|
| 114 | + $this->commandOptions[$optionName]['shortcut'] = $shortcut; |
|
| 115 | 115 | |
| 116 | - $this->commandOptionsShortcuts[ $shortcut ] = $optionName; |
|
| 116 | + $this->commandOptionsShortcuts[$shortcut] = $optionName; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if (array_key_exists('VERBOSE', $_ENV)) { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | ? '-' . substr($optionName, 0, 1) |
| 161 | 161 | : '-' . rtrim($optionShortcut); |
| 162 | 162 | |
| 163 | - $this->commandOptions[ $optionName ] = [ |
|
| 163 | + $this->commandOptions[$optionName] = [ |
|
| 164 | 164 | 'shortcut' => $optionShortcut, |
| 165 | 165 | 'description' => $optionDescription, |
| 166 | 166 | ]; |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | foreach ($options as $method => $arguments) { |
| 221 | 221 | |
| 222 | 222 | if (array_key_exists('-' . $method, $this->commandOptionsShortcuts)) { |
| 223 | - $method = $this->commandOptionsShortcuts[ '-' . $method ]; |
|
| 223 | + $method = $this->commandOptionsShortcuts['-' . $method]; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | if ($command->hasMethod($commandMethodName = camelcase('option-' . $method))) { |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | if ($commandMethod->getNumberOfRequiredParameters() == 0) { |
| 234 | 234 | call_user_func([&$this, $commandMethodName]); |
| 235 | 235 | } elseif ($commandMethod->getNumberOfRequiredParameters() > 0 and empty($arguments)) { |
| 236 | - if (isset($this->commandOptions[ $method ][ 'help' ])) { |
|
| 236 | + if (isset($this->commandOptions[$method]['help'])) { |
|
| 237 | 237 | output()->write( |
| 238 | 238 | (new Format()) |
| 239 | 239 | ->setContextualClass(Format::INFO) |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | output()->write( |
| 246 | 246 | (new Format()) |
| 247 | 247 | ->setContextualClass(Format::INFO) |
| 248 | - ->setString(language()->getLine($this->commandOptions[ $method ][ 'help' ])) |
|
| 248 | + ->setString(language()->getLine($this->commandOptions[$method]['help'])) |
|
| 249 | 249 | ->setNewLinesAfter(2) |
| 250 | 250 | ); |
| 251 | 251 | } |
@@ -359,8 +359,8 @@ discard block |
||
| 359 | 359 | $table |
| 360 | 360 | ->addRow() |
| 361 | 361 | ->addColumn('--' . $optionCaller) |
| 362 | - ->addColumn($optionProps[ 'shortcut' ]) |
|
| 363 | - ->addColumn(language()->getLine($optionProps[ 'description' ])); |
|
| 362 | + ->addColumn($optionProps['shortcut']) |
|
| 363 | + ->addColumn(language()->getLine($optionProps['description'])); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | output()->write( |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | */ |
| 411 | 411 | public function addCommander(AbstractCommander $commander) |
| 412 | 412 | { |
| 413 | - $this->actionsPool[ $commander->getCommandName() ] = $commander; |
|
| 413 | + $this->actionsPool[$commander->getCommandName()] = $commander; |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | // ------------------------------------------------------------------------ |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | break; |
| 57 | 57 | case 'PATH_INFO': |
| 58 | 58 | default: |
| 59 | - $segments = isset($_SERVER[ $protocol ]) |
|
| 60 | - ? $_SERVER[ $protocol ] |
|
| 59 | + $segments = isset($_SERVER[$protocol]) |
|
| 60 | + ? $_SERVER[$protocol] |
|
| 61 | 61 | : $this->parseRequestUri(); |
| 62 | 62 | break; |
| 63 | 63 | } |
@@ -87,23 +87,23 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | protected function parseRequestUri() |
| 89 | 89 | { |
| 90 | - if ( ! isset($_SERVER[ 'REQUEST_URI' ], $_SERVER[ 'SCRIPT_NAME' ])) { |
|
| 90 | + if ( ! isset($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME'])) { |
|
| 91 | 91 | return ''; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $uri = parse_url($_SERVER[ 'REQUEST_URI' ]); |
|
| 95 | - $query = isset($uri[ 'query' ]) |
|
| 96 | - ? $uri[ 'query' ] |
|
| 94 | + $uri = parse_url($_SERVER['REQUEST_URI']); |
|
| 95 | + $query = isset($uri['query']) |
|
| 96 | + ? $uri['query'] |
|
| 97 | 97 | : ''; |
| 98 | - $uri = isset($uri[ 'path' ]) |
|
| 99 | - ? $uri[ 'path' ] |
|
| 98 | + $uri = isset($uri['path']) |
|
| 99 | + ? $uri['path'] |
|
| 100 | 100 | : ''; |
| 101 | 101 | |
| 102 | - if (isset($_SERVER[ 'SCRIPT_NAME' ][ 0 ])) { |
|
| 103 | - if (strpos($uri, $_SERVER[ 'SCRIPT_NAME' ]) === 0) { |
|
| 104 | - $uri = (string)substr($uri, strlen($_SERVER[ 'SCRIPT_NAME' ])); |
|
| 105 | - } elseif (strpos($uri, dirname($_SERVER[ 'SCRIPT_NAME' ])) === 0) { |
|
| 106 | - $uri = (string)substr($uri, strlen(dirname($_SERVER[ 'SCRIPT_NAME' ]))); |
|
| 102 | + if (isset($_SERVER['SCRIPT_NAME'][0])) { |
|
| 103 | + if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) { |
|
| 104 | + $uri = (string)substr($uri, strlen($_SERVER['SCRIPT_NAME'])); |
|
| 105 | + } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) { |
|
| 106 | + $uri = (string)substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -111,26 +111,26 @@ discard block |
||
| 111 | 111 | // URI is found, and also fixes the QUERY_STRING server var and $_GET array. |
| 112 | 112 | if (trim($uri, '/') === '' AND strncmp($query, '/', 1) === 0) { |
| 113 | 113 | $query = explode('?', $query, 2); |
| 114 | - $uri = $query[ 0 ]; |
|
| 114 | + $uri = $query[0]; |
|
| 115 | 115 | |
| 116 | - $_SERVER[ 'QUERY_STRING' ] = isset($query[ 1 ]) |
|
| 117 | - ? $query[ 1 ] |
|
| 116 | + $_SERVER['QUERY_STRING'] = isset($query[1]) |
|
| 117 | + ? $query[1] |
|
| 118 | 118 | : ''; |
| 119 | 119 | } else { |
| 120 | - $_SERVER[ 'QUERY_STRING' ] = $query; |
|
| 120 | + $_SERVER['QUERY_STRING'] = $query; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - if (isset($_GET[ 'SEGMENTS_STRING' ])) { |
|
| 124 | - $uri = $_GET[ 'SEGMENTS_STRING' ]; |
|
| 125 | - unset($_GET[ 'SEGMENTS_STRING' ]); |
|
| 123 | + if (isset($_GET['SEGMENTS_STRING'])) { |
|
| 124 | + $uri = $_GET['SEGMENTS_STRING']; |
|
| 125 | + unset($_GET['SEGMENTS_STRING']); |
|
| 126 | 126 | |
| 127 | - $_SERVER[ 'QUERY_STRING' ] = str_replace([ |
|
| 127 | + $_SERVER['QUERY_STRING'] = str_replace([ |
|
| 128 | 128 | 'SEGMENTS_STRING=' . $uri . '&', |
| 129 | 129 | 'SEGMENTS_STRING=' . $uri, |
| 130 | - ], '', $_SERVER[ 'QUERY_STRING' ]); |
|
| 130 | + ], '', $_SERVER['QUERY_STRING']); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - parse_str($_SERVER[ 'QUERY_STRING' ], $_GET); |
|
| 133 | + parse_str($_SERVER['QUERY_STRING'], $_GET); |
|
| 134 | 134 | |
| 135 | 135 | if ($uri === '/' || $uri === '') { |
| 136 | 136 | return '/'; |
@@ -153,21 +153,21 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | protected function parseQueryString() |
| 155 | 155 | { |
| 156 | - $uri = isset($_SERVER[ 'QUERY_STRING' ]) |
|
| 157 | - ? $_SERVER[ 'QUERY_STRING' ] |
|
| 156 | + $uri = isset($_SERVER['QUERY_STRING']) |
|
| 157 | + ? $_SERVER['QUERY_STRING'] |
|
| 158 | 158 | : @getenv('QUERY_STRING'); |
| 159 | 159 | |
| 160 | 160 | if (trim($uri, '/') === '') { |
| 161 | 161 | return ''; |
| 162 | 162 | } elseif (strncmp($uri, '/', 1) === 0) { |
| 163 | 163 | $uri = explode('?', $uri, 2); |
| 164 | - $_SERVER[ 'QUERY_STRING' ] = isset($uri[ 1 ]) |
|
| 165 | - ? $uri[ 1 ] |
|
| 164 | + $_SERVER['QUERY_STRING'] = isset($uri[1]) |
|
| 165 | + ? $uri[1] |
|
| 166 | 166 | : ''; |
| 167 | - $uri = rawurldecode($uri[ 0 ]); |
|
| 167 | + $uri = rawurldecode($uri[0]); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - parse_str($_SERVER[ 'QUERY_STRING' ], $_GET); |
|
| 170 | + parse_str($_SERVER['QUERY_STRING'], $_GET); |
|
| 171 | 171 | |
| 172 | 172 | return $uri; |
| 173 | 173 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | public function getPart($index) |
| 254 | 254 | { |
| 255 | - if($this->offsetExists($index)) { |
|
| 255 | + if ($this->offsetExists($index)) { |
|
| 256 | 256 | return $this->offsetGet($index); |
| 257 | 257 | } |
| 258 | 258 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $validSegments = array_filter($validSegments); |
| 296 | 296 | array_unshift($validSegments, null); |
| 297 | 297 | |
| 298 | - unset($validSegments[ 0 ]); |
|
| 298 | + unset($validSegments[0]); |
|
| 299 | 299 | |
| 300 | 300 | $this->merge($validSegments); |
| 301 | 301 | } |