@@ -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); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if (isset($_REQUEST[ 'GLOBALS' ])) { |
|
| 47 | + if (isset($_REQUEST['GLOBALS'])) { |
|
| 48 | 48 | die('GLOBALS overwrite attempt detected'); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, |
| 55 | 55 | isset($_SESSION) && is_array($_SESSION) ? $_SESSION : []); |
| 56 | 56 | foreach ($input as $k => $v) { |
| 57 | - if ( ! in_array($k, $no_unset) && isset($GLOBALS[ $k ])) { |
|
| 58 | - unset($GLOBALS[ $k ]); |
|
| 57 | + if ( ! in_array($k, $no_unset) && isset($GLOBALS[$k])) { |
|
| 58 | + unset($GLOBALS[$k]); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
@@ -68,51 +68,51 @@ discard block |
||
| 68 | 68 | $_SERVER = array_merge($default_server_values, $_SERVER); |
| 69 | 69 | |
| 70 | 70 | // Fix for IIS when running with PHP ISAPI |
| 71 | - if (empty($_SERVER[ 'REQUEST_URI' ]) || (PHP_SAPI != 'cgi-fcgi' && preg_match('/^Microsoft-IIS\//', |
|
| 72 | - $_SERVER[ 'SERVER_SOFTWARE' ]))) { |
|
| 71 | + if (empty($_SERVER['REQUEST_URI']) || (PHP_SAPI != 'cgi-fcgi' && preg_match('/^Microsoft-IIS\//', |
|
| 72 | + $_SERVER['SERVER_SOFTWARE']))) { |
|
| 73 | 73 | |
| 74 | - if (isset($_SERVER[ 'HTTP_X_ORIGINAL_URL' ])) { |
|
| 74 | + if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { |
|
| 75 | 75 | // IIS Mod-Rewrite |
| 76 | - $_SERVER[ 'REQUEST_URI' ] = $_SERVER[ 'HTTP_X_ORIGINAL_URL' ]; |
|
| 77 | - } elseif (isset($_SERVER[ 'HTTP_X_REWRITE_URL' ])) { |
|
| 76 | + $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; |
|
| 77 | + } elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) { |
|
| 78 | 78 | // IIS Isapi_Rewrite |
| 79 | - $_SERVER[ 'REQUEST_URI' ] = $_SERVER[ 'HTTP_X_REWRITE_URL' ]; |
|
| 79 | + $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; |
|
| 80 | 80 | } else { |
| 81 | 81 | // Use ORIG_PATH_INFO if there is no PATH_INFO |
| 82 | - if ( ! isset($_SERVER[ 'PATH_INFO' ]) && isset($_SERVER[ 'ORIG_PATH_INFO' ])) { |
|
| 83 | - $_SERVER[ 'PATH_INFO' ] = $_SERVER[ 'ORIG_PATH_INFO' ]; |
|
| 82 | + if ( ! isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO'])) { |
|
| 83 | + $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice) |
| 87 | - if (isset($_SERVER[ 'PATH_INFO' ])) { |
|
| 88 | - if ($_SERVER[ 'PATH_INFO' ] == $_SERVER[ 'SCRIPT_NAME' ]) { |
|
| 89 | - $_SERVER[ 'REQUEST_URI' ] = $_SERVER[ 'PATH_INFO' ]; |
|
| 87 | + if (isset($_SERVER['PATH_INFO'])) { |
|
| 88 | + if ($_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME']) { |
|
| 89 | + $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; |
|
| 90 | 90 | } else { |
| 91 | - $_SERVER[ 'REQUEST_URI' ] = $_SERVER[ 'SCRIPT_NAME' ] . $_SERVER[ 'PATH_INFO' ]; |
|
| 91 | + $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Append the query string if it exists and isn't null |
| 96 | - if ( ! empty($_SERVER[ 'QUERY_STRING' ])) { |
|
| 97 | - $_SERVER[ 'REQUEST_URI' ] .= '?' . $_SERVER[ 'QUERY_STRING' ]; |
|
| 96 | + if ( ! empty($_SERVER['QUERY_STRING'])) { |
|
| 97 | + $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests |
| 103 | - if (isset($_SERVER[ 'SCRIPT_FILENAME' ]) && (strpos($_SERVER[ 'SCRIPT_FILENAME' ], |
|
| 104 | - 'php.cgi') == strlen($_SERVER[ 'SCRIPT_FILENAME' ]) - 7)) { |
|
| 105 | - $_SERVER[ 'SCRIPT_FILENAME' ] = $_SERVER[ 'PATH_TRANSLATED' ]; |
|
| 103 | + if (isset($_SERVER['SCRIPT_FILENAME']) && (strpos($_SERVER['SCRIPT_FILENAME'], |
|
| 104 | + 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7)) { |
|
| 105 | + $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // Fix for Dreamhost and other PHP as CGI hosts |
| 109 | - if (strpos($_SERVER[ 'SCRIPT_NAME' ], 'php.cgi') !== false) { |
|
| 110 | - unset($_SERVER[ 'PATH_INFO' ]); |
|
| 109 | + if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false) { |
|
| 110 | + unset($_SERVER['PATH_INFO']); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // Fix empty PHP_SELF |
| 114 | 114 | if (empty($PHP_SELF)) { |
| 115 | - $_SERVER[ 'PHP_SELF' ] = $PHP_SELF = preg_replace('/(\?.*)?$/', '', $_SERVER[ 'REQUEST_URI' ]); |
|
| 115 | + $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace('/(\?.*)?$/', '', $_SERVER['REQUEST_URI']); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | // Use $_GET directly here, since filter_has_var only |
| 138 | 138 | // checks the initial GET data, not anything that might |
| 139 | 139 | // have been added since. |
| 140 | - return isset($_GET[ $offset ]) |
|
| 140 | + return isset($_GET[$offset]) |
|
| 141 | 141 | ? $this->get($offset, $filter) |
| 142 | 142 | : $this->post($offset, $filter); |
| 143 | 143 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $loopThrough = []; |
| 224 | 224 | |
| 225 | 225 | foreach ($offset as $key) { |
| 226 | - $loopThrough[ $key ] = $this->filter($type, $key, $filter); |
|
| 226 | + $loopThrough[$key] = $this->filter($type, $key, $filter); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if (empty($loopThrough)) { |
@@ -237,38 +237,38 @@ discard block |
||
| 237 | 237 | // of the simpler filter_input(); |
| 238 | 238 | switch ($type) { |
| 239 | 239 | case INPUT_GET: |
| 240 | - $value = isset($_GET[ $offset ]) |
|
| 241 | - ? $_GET[ $offset ] |
|
| 240 | + $value = isset($_GET[$offset]) |
|
| 241 | + ? $_GET[$offset] |
|
| 242 | 242 | : null; |
| 243 | 243 | break; |
| 244 | 244 | case INPUT_POST: |
| 245 | - $value = isset($_POST[ $offset ]) |
|
| 246 | - ? $_POST[ $offset ] |
|
| 245 | + $value = isset($_POST[$offset]) |
|
| 246 | + ? $_POST[$offset] |
|
| 247 | 247 | : null; |
| 248 | 248 | break; |
| 249 | 249 | case INPUT_SERVER: |
| 250 | - $value = isset($_SERVER[ $offset ]) |
|
| 251 | - ? $_SERVER[ $offset ] |
|
| 250 | + $value = isset($_SERVER[$offset]) |
|
| 251 | + ? $_SERVER[$offset] |
|
| 252 | 252 | : null; |
| 253 | 253 | break; |
| 254 | 254 | case INPUT_ENV: |
| 255 | - $value = isset($_ENV[ $offset ]) |
|
| 256 | - ? $_ENV[ $offset ] |
|
| 255 | + $value = isset($_ENV[$offset]) |
|
| 256 | + ? $_ENV[$offset] |
|
| 257 | 257 | : null; |
| 258 | 258 | break; |
| 259 | 259 | case INPUT_COOKIE: |
| 260 | - $value = isset($_COOKIE[ $offset ]) |
|
| 261 | - ? $_COOKIE[ $offset ] |
|
| 260 | + $value = isset($_COOKIE[$offset]) |
|
| 261 | + ? $_COOKIE[$offset] |
|
| 262 | 262 | : null; |
| 263 | 263 | break; |
| 264 | 264 | case INPUT_REQUEST: |
| 265 | - $value = isset($_REQUEST[ $offset ]) |
|
| 266 | - ? $_REQUEST[ $offset ] |
|
| 265 | + $value = isset($_REQUEST[$offset]) |
|
| 266 | + ? $_REQUEST[$offset] |
|
| 267 | 267 | : null; |
| 268 | 268 | break; |
| 269 | 269 | case INPUT_SESSION: |
| 270 | - $value = isset($_SESSION[ $offset ]) |
|
| 271 | - ? $_SESSION[ $offset ] |
|
| 270 | + $value = isset($_SESSION[$offset]) |
|
| 271 | + ? $_SESSION[$offset] |
|
| 272 | 272 | : null; |
| 273 | 273 | break; |
| 274 | 274 | default: |
@@ -327,13 +327,13 @@ discard block |
||
| 327 | 327 | { |
| 328 | 328 | foreach ($data as $key => $value) { |
| 329 | 329 | if (is_array($value) AND is_array($filter)) { |
| 330 | - $data[ $key ] = filter_var_array($value, $filter); |
|
| 330 | + $data[$key] = filter_var_array($value, $filter); |
|
| 331 | 331 | } elseif (is_array($value)) { |
| 332 | - $data[ $key ] = $this->filterRecursive($value, $filter); |
|
| 332 | + $data[$key] = $this->filterRecursive($value, $filter); |
|
| 333 | 333 | } elseif (isset($filter)) { |
| 334 | - $data[ $key ] = filter_var($value, $filter); |
|
| 334 | + $data[$key] = filter_var($value, $filter); |
|
| 335 | 335 | } else { |
| 336 | - $data[ $key ] = $value; |
|
| 336 | + $data[$key] = $value; |
|
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | // Use $_POST directly here, since filter_has_var only |
| 383 | 383 | // checks the initial POST data, not anything that might |
| 384 | 384 | // have been added since. |
| 385 | - return isset($_POST[ $offset ]) |
|
| 385 | + return isset($_POST[$offset]) |
|
| 386 | 386 | ? $this->post($offset, $filter) |
| 387 | 387 | : $this->get($offset, $filter); |
| 388 | 388 | } |
@@ -405,8 +405,8 @@ discard block |
||
| 405 | 405 | $uploadFiles = server_request()->getUploadedFiles(); |
| 406 | 406 | |
| 407 | 407 | if (isset($offset)) { |
| 408 | - if (isset($uploadFiles[ $offset ])) { |
|
| 409 | - return $uploadFiles[ $offset ]; |
|
| 408 | + if (isset($uploadFiles[$offset])) { |
|
| 409 | + return $uploadFiles[$offset]; |
|
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | |
@@ -632,6 +632,6 @@ discard block |
||
| 632 | 632 | */ |
| 633 | 633 | final public function submit() |
| 634 | 634 | { |
| 635 | - return (bool)isset($_POST[ 'submit' ]); |
|
| 635 | + return (bool)isset($_POST['submit']); |
|
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | \ No newline at end of file |
@@ -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 | } |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function handle() |
| 65 | 65 | { |
| 66 | - $argv = $_SERVER[ 'argv' ]; |
|
| 66 | + $argv = $_SERVER['argv']; |
|
| 67 | 67 | |
| 68 | - if ($_SERVER[ 'SCRIPT_NAME' ] === $_SERVER[ 'argv' ][ 0 ]) { |
|
| 68 | + if ($_SERVER['SCRIPT_NAME'] === $_SERVER['argv'][0]) { |
|
| 69 | 69 | array_shift($argv); |
| 70 | 70 | |
| 71 | 71 | if (empty($argv)) { |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - $this->string = str_replace(['/', '\\', ':'], '/', $argv[ 0 ]); |
|
| 76 | + $this->string = str_replace(['/', '\\', ':'], '/', $argv[0]); |
|
| 77 | 77 | $this->commands = explode('/', $this->string); |
| 78 | 78 | |
| 79 | - if (strpos($this->commands[ 0 ], '--') !== false |
|
| 80 | - || strpos($this->commands[ 0 ], '-') !== false |
|
| 79 | + if (strpos($this->commands[0], '--') !== false |
|
| 80 | + || strpos($this->commands[0], '-') !== false |
|
| 81 | 81 | ) { |
| 82 | 82 | $options = $this->commands; |
| 83 | 83 | $this->commands = []; |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | if (strpos($option, '=') !== false) { |
| 98 | 98 | $optionParts = explode('=', $option); |
| 99 | - $option = $optionParts[ 0 ]; |
|
| 100 | - $value = $optionParts[ 1 ]; |
|
| 99 | + $option = $optionParts[0]; |
|
| 100 | + $value = $optionParts[1]; |
|
| 101 | 101 | } else { |
| 102 | 102 | $value = current($options); |
| 103 | 103 | } |
@@ -111,24 +111,24 @@ discard block |
||
| 111 | 111 | if (strpos($value, '--') === false |
| 112 | 112 | || strpos($value, '-') === false |
| 113 | 113 | ) { |
| 114 | - $_GET[ $option ] = $value; |
|
| 114 | + $_GET[$option] = $value; |
|
| 115 | 115 | } else { |
| 116 | - $_GET[ $option ] = null; |
|
| 116 | + $_GET[$option] = null; |
|
| 117 | 117 | } |
| 118 | 118 | } else { |
| 119 | 119 | $keys = array_keys($_GET); |
| 120 | 120 | if (count($keys)) { |
| 121 | 121 | $key = end($keys); |
| 122 | - $_GET[ $key ] = $option; |
|
| 122 | + $_GET[$key] = $option; |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (array_key_exists('verbose', $_GET) or array_key_exists('v', $_GET)) { |
| 128 | - $_ENV[ 'VERBOSE' ] = true; |
|
| 128 | + $_ENV['VERBOSE'] = true; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if( $this->parseCommands($this->commands) === false ){ |
|
| 131 | + if ($this->parseCommands($this->commands) === false) { |
|
| 132 | 132 | output()->sendError(404); |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -213,17 +213,17 @@ discard block |
||
| 213 | 213 | loader()->addNamespace($commander->getNamespaceName(), $commander->getFileInfo()->getPath()); |
| 214 | 214 | |
| 215 | 215 | $commanderMethod = 'execute'; |
| 216 | - if(count($commands)) { |
|
| 216 | + if (count($commands)) { |
|
| 217 | 217 | $commanderMethod = camelcase(reset($commands)); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - if($commander->hasMethod('route')) { |
|
| 220 | + if ($commander->hasMethod('route')) { |
|
| 221 | 221 | $commander |
| 222 | 222 | ->setRequestMethod('route') |
| 223 | 223 | ->setRequestMethodArgs([$commanderMethod]); |
| 224 | - } elseif($commander->hasMethod($commanderMethod)) { |
|
| 224 | + } elseif ($commander->hasMethod($commanderMethod)) { |
|
| 225 | 225 | $commander->setRequestMethod($commanderMethod); |
| 226 | - } elseif($commander->hasMethod('execute')) { |
|
| 226 | + } elseif ($commander->hasMethod('execute')) { |
|
| 227 | 227 | $commander->setRequestMethod('execute'); |
| 228 | 228 | } |
| 229 | 229 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function __get($property) |
| 70 | 70 | { |
| 71 | - if(property_exists($this, $property)) { |
|
| 71 | + if (property_exists($this, $property)) { |
|
| 72 | 72 | return $this->{$property}; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function isAjax() |
| 130 | 130 | { |
| 131 | - return ( ! empty($_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) && |
|
| 132 | - strtolower($_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) === 'xmlhttprequest'); |
|
| 131 | + return ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && |
|
| 132 | + strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | //-------------------------------------------------------------------- |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function isSecure() |
| 146 | 146 | { |
| 147 | - if ( ! empty($_SERVER[ 'HTTPS' ]) && strtolower($_SERVER[ 'HTTPS' ]) !== 'off') { |
|
| 147 | + if ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { |
|
| 148 | 148 | return true; |
| 149 | - } elseif (isset($_SERVER[ 'HTTP_X_FORWARDED_PROTO' ]) && $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ] === 'https') { |
|
| 149 | + } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { |
|
| 150 | 150 | return true; |
| 151 | - } elseif ( ! empty($_SERVER[ 'HTTP_FRONT_END_HTTPS' ]) && strtolower( |
|
| 152 | - $_SERVER[ 'HTTP_FRONT_END_HTTPS' ] |
|
| 151 | + } elseif ( ! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower( |
|
| 152 | + $_SERVER['HTTP_FRONT_END_HTTPS'] |
|
| 153 | 153 | ) !== 'off' |
| 154 | 154 | ) { |
| 155 | 155 | return true; |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | public function getTime($format = null) |
| 171 | 171 | { |
| 172 | 172 | return isset($format) |
| 173 | - ? date($format, $_SERVER[ 'REQUEST_TIME' ]) |
|
| 174 | - : $_SERVER[ 'REQUEST_TIME' ]; |
|
| 173 | + ? date($format, $_SERVER['REQUEST_TIME']) |
|
| 174 | + : $_SERVER['REQUEST_TIME']; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | //-------------------------------------------------------------------- |
@@ -253,12 +253,12 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | $uri = $this->uri; |
| 255 | 255 | |
| 256 | - if (isset($parseTarget[ 'path' ])) { |
|
| 257 | - $uri = $this->uri->withPath($parseTarget[ 'path' ]); |
|
| 256 | + if (isset($parseTarget['path'])) { |
|
| 257 | + $uri = $this->uri->withPath($parseTarget['path']); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - if (isset($parseTarget[ 'query' ])) { |
|
| 261 | - $uri = $this->uri->withPath($parseTarget[ 'query' ]); |
|
| 260 | + if (isset($parseTarget['query'])) { |
|
| 261 | + $uri = $this->uri->withPath($parseTarget['query']); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | $this->uri = $uri; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $this->handleExtensionRequest(); |
| 103 | 103 | } else { |
| 104 | 104 | $uriPath = urldecode( |
| 105 | - parse_url($_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH) |
|
| 105 | + parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) |
|
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | 108 | $uriPathParts = explode('public/', $uriPath); |
@@ -273,8 +273,8 @@ discard block |
||
| 273 | 273 | ); |
| 274 | 274 | } elseif (preg_match("/([a-zA-Z0-9\\\]+)(@)([a-zA-Z0-9\\\]+)/", $closure, $matches)) { |
| 275 | 275 | $this->setController( |
| 276 | - (new Router\DataStructures\Controller($matches[ 1 ])) |
|
| 277 | - ->setRequestMethod($matches[ 3 ]), |
|
| 276 | + (new Router\DataStructures\Controller($matches[1])) |
|
| 277 | + ->setRequestMethod($matches[3]), |
|
| 278 | 278 | $uriSegments |
| 279 | 279 | ); |
| 280 | 280 | } elseif (is_string($closure) && $closure !== '') { |
@@ -363,10 +363,10 @@ discard block |
||
| 363 | 363 | $parameters = $controllerMethodParams; |
| 364 | 364 | } else { |
| 365 | 365 | foreach ($method->getParameters() as $index => $parameter) { |
| 366 | - if (isset($uriSegments[ $parameter->name ])) { |
|
| 367 | - $parameters[ $index ] = $controllerMethodParams[ $parameter->name ]; |
|
| 366 | + if (isset($uriSegments[$parameter->name])) { |
|
| 367 | + $parameters[$index] = $controllerMethodParams[$parameter->name]; |
|
| 368 | 368 | } else { |
| 369 | - $parameters[ $index ] = null; |
|
| 369 | + $parameters[$index] = null; |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | } |