@@ -82,15 +82,15 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | if (is_array($lastError)) { |
| 84 | 84 | $this->errorHandler( |
| 85 | - $lastError[ 'type' ], |
|
| 86 | - $lastError[ 'message' ], |
|
| 87 | - $lastError[ 'file' ], |
|
| 88 | - $lastError[ 'line' ] |
|
| 85 | + $lastError['type'], |
|
| 86 | + $lastError['message'], |
|
| 87 | + $lastError['file'], |
|
| 88 | + $lastError['line'] |
|
| 89 | 89 | ); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | // Execute shutdown service |
| 93 | - if(services()->has('shutdown')) { |
|
| 93 | + if (services()->has('shutdown')) { |
|
| 94 | 94 | shutdown()->execute(); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $error = new ErrorException($errstr, $errno, $errfile, $errline); |
| 135 | 135 | |
| 136 | 136 | // Logged the error |
| 137 | - if(services()->has('logger')) { |
|
| 137 | + if (services()->has('logger')) { |
|
| 138 | 138 | logger()->error( |
| 139 | 139 | implode( |
| 140 | 140 | ' ', |
@@ -370,8 +370,8 @@ discard block |
||
| 370 | 370 | $errors = require(str_replace('Cli', 'Config', __DIR__) . DIRECTORY_SEPARATOR . 'Errors.php'); |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - if (isset($errors[ $code ])) { |
|
| 374 | - $languageKey = $errors[ $code ]; |
|
| 373 | + if (isset($errors[$code])) { |
|
| 374 | + $languageKey = $errors[$code]; |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | $languageKey = strtoupper($code . '_' . $languageKey); |
@@ -383,10 +383,10 @@ discard block |
||
| 383 | 383 | ]; |
| 384 | 384 | |
| 385 | 385 | $this->statusCode = $code; |
| 386 | - $this->reasonPhrase = $error[ 'title' ]; |
|
| 386 | + $this->reasonPhrase = $error['title']; |
|
| 387 | 387 | |
| 388 | 388 | if (is_string($vars)) { |
| 389 | - $error[ 'message' ] = $vars; |
|
| 389 | + $error['message'] = $vars; |
|
| 390 | 390 | } elseif (is_array($vars)) { |
| 391 | 391 | $error = array_merge($error, $vars); |
| 392 | 392 | } |
@@ -394,13 +394,13 @@ discard block |
||
| 394 | 394 | $this->write( |
| 395 | 395 | (new Format()) |
| 396 | 396 | ->setContextualClass(Format::DANGER) |
| 397 | - ->setString($error[ 'code' ] . ' - ' . $error[ 'title' ]) |
|
| 397 | + ->setString($error['code'] . ' - ' . $error['title']) |
|
| 398 | 398 | ->setNewLinesAfter(1) |
| 399 | 399 | ); |
| 400 | 400 | |
| 401 | 401 | $this->write( |
| 402 | 402 | (new Format()) |
| 403 | - ->setString($error[ 'message' ]) |
|
| 403 | + ->setString($error['message']) |
|
| 404 | 404 | ->setNewLinesAfter(1) |
| 405 | 405 | ); |
| 406 | 406 | |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | public function verbose($text, $type = 'stdout') |
| 421 | 421 | { |
| 422 | - if (isset($_ENV[ 'VERBOSE' ]) and $_ENV[ 'VERBOSE' ] === true) { |
|
| 422 | + if (isset($_ENV['VERBOSE']) and $_ENV['VERBOSE'] === true) { |
|
| 423 | 423 | $this->write($text, $type); |
| 424 | 424 | } |
| 425 | 425 | } |
@@ -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 |
@@ -104,17 +104,17 @@ discard block |
||
| 104 | 104 | $this->commandName = implode('/', array_map('strtolower', explode('/', $className))); |
| 105 | 105 | |
| 106 | 106 | foreach ($this->commandOptions as $optionName => $optionConfig) { |
| 107 | - $shortcut = empty($optionConfig[ 'shortcut' ]) |
|
| 107 | + $shortcut = empty($optionConfig['shortcut']) |
|
| 108 | 108 | ? '-' . substr($optionName, 0, 1) |
| 109 | - : '-' . rtrim($optionConfig[ 'shortcut' ]); |
|
| 109 | + : '-' . rtrim($optionConfig['shortcut']); |
|
| 110 | 110 | |
| 111 | 111 | if (array_key_exists($shortcut, $this->commandOptionsShortcuts)) { |
| 112 | 112 | $shortcut = '-' . substr($optionName, 0, 2); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $this->commandOptions[ $optionName ][ 'shortcut' ] = $shortcut; |
|
| 115 | + $this->commandOptions[$optionName]['shortcut'] = $shortcut; |
|
| 116 | 116 | |
| 117 | - $this->commandOptionsShortcuts[ $shortcut ] = $optionName; |
|
| 117 | + $this->commandOptionsShortcuts[$shortcut] = $optionName; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | if (array_key_exists('VERBOSE', $_ENV)) { |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | ? '-' . substr($optionName, 0, 1) |
| 162 | 162 | : '-' . rtrim($optionShortcut); |
| 163 | 163 | |
| 164 | - $this->commandOptions[ $optionName ] = [ |
|
| 164 | + $this->commandOptions[$optionName] = [ |
|
| 165 | 165 | 'shortcut' => $optionShortcut, |
| 166 | 166 | 'description' => $optionDescription, |
| 167 | 167 | ]; |
@@ -202,14 +202,14 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | protected function __callOptions() |
| 204 | 204 | { |
| 205 | - if(false !== ($options = input()->get())) { |
|
| 206 | - if(count($options)) { |
|
| 205 | + if (false !== ($options = input()->get())) { |
|
| 206 | + if (count($options)) { |
|
| 207 | 207 | $command = new \ReflectionClass($this); |
| 208 | 208 | |
| 209 | 209 | foreach ($options as $method => $arguments) { |
| 210 | 210 | |
| 211 | 211 | if (array_key_exists('-' . $method, $this->commandOptionsShortcuts)) { |
| 212 | - $method = $this->commandOptionsShortcuts[ '-' . $method ]; |
|
| 212 | + $method = $this->commandOptionsShortcuts['-' . $method]; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $optionMethod = camelcase('option-' . $method); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | if ($commandMethod->getNumberOfRequiredParameters() == 0) { |
| 222 | 222 | call_user_func_array([&$this, $optionMethod], [$arguments]); |
| 223 | 223 | } elseif ($commandMethod->getNumberOfRequiredParameters() > 0 and empty($arguments)) { |
| 224 | - if (isset($this->commandOptions[ $method ][ 'help' ])) { |
|
| 224 | + if (isset($this->commandOptions[$method]['help'])) { |
|
| 225 | 225 | output()->write( |
| 226 | 226 | (new Format()) |
| 227 | 227 | ->setContextualClass(Format::INFO) |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | output()->write( |
| 234 | 234 | (new Format()) |
| 235 | 235 | ->setContextualClass(Format::INFO) |
| 236 | - ->setString(language()->getLine($this->commandOptions[ $method ][ 'help' ])) |
|
| 236 | + ->setString(language()->getLine($this->commandOptions[$method]['help'])) |
|
| 237 | 237 | ->setNewLinesAfter(2) |
| 238 | 238 | ); |
| 239 | 239 | } |
@@ -347,8 +347,8 @@ discard block |
||
| 347 | 347 | $table |
| 348 | 348 | ->addRow() |
| 349 | 349 | ->addColumn('--' . $optionCaller) |
| 350 | - ->addColumn($optionProps[ 'shortcut' ]) |
|
| 351 | - ->addColumn(language()->getLine($optionProps[ 'description' ])); |
|
| 350 | + ->addColumn($optionProps['shortcut']) |
|
| 351 | + ->addColumn(language()->getLine($optionProps['description'])); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | output()->write( |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | public function addCommander(AbstractCommander $commander) |
| 400 | 400 | { |
| 401 | - $this->actionsPool[ $commander->getCommandName() ] = $commander; |
|
| 401 | + $this->actionsPool[$commander->getCommandName()] = $commander; |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | // ------------------------------------------------------------------------ |