@@ -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 | } |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | static $_is_php; |
| 26 | 26 | $version = (string)$version; |
| 27 | 27 | |
| 28 | - if ( ! isset($_is_php[ $version ])) { |
|
| 29 | - $_is_php[ $version ] = version_compare(PHP_VERSION, $version, '>='); |
|
| 28 | + if ( ! isset($_is_php[$version])) { |
|
| 29 | + $_is_php[$version] = version_compare(PHP_VERSION, $version, '>='); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - return $_is_php[ $version ]; |
|
| 32 | + return $_is_php[$version]; |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | function is_https() |
| 133 | 133 | { |
| 134 | - if ( ! empty($_SERVER[ 'HTTPS' ]) && strtolower($_SERVER[ 'HTTPS' ]) !== 'off') { |
|
| 134 | + if ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { |
|
| 135 | 135 | return true; |
| 136 | - } elseif (isset($_SERVER[ 'HTTP_X_FORWARDED_PROTO' ]) && $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ] === 'https') { |
|
| 136 | + } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { |
|
| 137 | 137 | return true; |
| 138 | - } elseif ( ! empty($_SERVER[ 'HTTP_FRONT_END_HTTPS' ]) && strtolower( |
|
| 139 | - $_SERVER[ 'HTTP_FRONT_END_HTTPS' ] |
|
| 138 | + } elseif ( ! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower( |
|
| 139 | + $_SERVER['HTTP_FRONT_END_HTTPS'] |
|
| 140 | 140 | ) !== 'off' |
| 141 | 141 | ) { |
| 142 | 142 | return true; |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | function is_ajax() |
| 176 | 176 | { |
| 177 | - return ( ! empty($_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) && strtolower( |
|
| 178 | - $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] |
|
| 177 | + return ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower( |
|
| 178 | + $_SERVER['HTTP_X_REQUESTED_WITH'] |
|
| 179 | 179 | ) === 'xmlhttprequest'); |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -201,11 +201,11 @@ discard block |
||
| 201 | 201 | // every control character except newline (dec 10), |
| 202 | 202 | // carriage return (dec 13) and horizontal tab (dec 09) |
| 203 | 203 | if ($url_encoded) { |
| 204 | - $non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15 |
|
| 205 | - $non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31 |
|
| 204 | + $non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15 |
|
| 205 | + $non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31 |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
|
| 208 | + $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
|
| 209 | 209 | |
| 210 | 210 | do { |
| 211 | 211 | $str = preg_replace($non_displayables, '', $str, -1, $count); |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | $matches_regex = explode('_', $header_key); |
| 287 | 287 | if (count($matches_regex) > 0 and strlen($header_key) > 2) { |
| 288 | 288 | foreach ($matches_regex as $match_key => $match_value) { |
| 289 | - $matches_regex[ $match_key ] = ucfirst($match_value); |
|
| 289 | + $matches_regex[$match_key] = ucfirst($match_value); |
|
| 290 | 290 | } |
| 291 | 291 | $header_key = implode('-', $matches_regex); |
| 292 | 292 | } |
| 293 | - $headers[ $header_key ] = $server_value; |
|
| 293 | + $headers[$header_key] = $server_value; |
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | |
@@ -310,8 +310,8 @@ discard block |
||
| 310 | 310 | function path_to_url($path) |
| 311 | 311 | { |
| 312 | 312 | $path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path); |
| 313 | - $root_dir = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $_SERVER[ 'DOCUMENT_ROOT' ]); |
|
| 314 | - $base_dir = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, dirname($_SERVER[ 'SCRIPT_FILENAME' ])); |
|
| 313 | + $root_dir = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT']); |
|
| 314 | + $base_dir = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, dirname($_SERVER['SCRIPT_FILENAME'])); |
|
| 315 | 315 | |
| 316 | 316 | $root_dir = rtrim($root_dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
| 317 | 317 | $base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
@@ -326,15 +326,15 @@ discard block |
||
| 326 | 326 | |
| 327 | 327 | $base_url = is_https() ? 'https' : 'http'; |
| 328 | 328 | |
| 329 | - if (isset($_SERVER[ 'HTTP_HOST' ])) { |
|
| 330 | - $base_url .= '://' . $_SERVER[ 'HTTP_HOST' ]; |
|
| 331 | - } elseif (isset($_SERVER[ 'SERVER_NAME' ])) { |
|
| 329 | + if (isset($_SERVER['HTTP_HOST'])) { |
|
| 330 | + $base_url .= '://' . $_SERVER['HTTP_HOST']; |
|
| 331 | + } elseif (isset($_SERVER['SERVER_NAME'])) { |
|
| 332 | 332 | |
| 333 | 333 | // Add server name |
| 334 | - $base_url .= '://' . $_SERVER[ 'SERVER_NAME' ]; |
|
| 334 | + $base_url .= '://' . $_SERVER['SERVER_NAME']; |
|
| 335 | 335 | |
| 336 | 336 | // Add server port if needed |
| 337 | - $base_url .= $_SERVER[ 'SERVER_PORT' ] !== '80' ? ':' . $_SERVER[ 'SERVER_PORT' ] : ''; |
|
| 337 | + $base_url .= $_SERVER['SERVER_PORT'] !== '80' ? ':' . $_SERVER['SERVER_PORT'] : ''; |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | // Add base path |
@@ -342,11 +342,11 @@ discard block |
||
| 342 | 342 | $base_url = str_replace(DIRECTORY_SEPARATOR, '/', $base_url); |
| 343 | 343 | $base_url = trim($base_url, '/') . '/'; |
| 344 | 344 | |
| 345 | - if(strpos($path, 'resources') !== false && defined('PATH_RESOURCES')) { |
|
| 345 | + if (strpos($path, 'resources') !== false && defined('PATH_RESOURCES')) { |
|
| 346 | 346 | $path_url = 'resources' . '/' . str_replace(PATH_RESOURCES, '', $path); |
| 347 | - } elseif(strpos($path, 'public') !== false && defined('PATH_PUBLIC')) { |
|
| 347 | + } elseif (strpos($path, 'public') !== false && defined('PATH_PUBLIC')) { |
|
| 348 | 348 | $path_url = str_replace(PATH_PUBLIC, '', $path); |
| 349 | - } elseif(strpos($path, 'storage') !== false && defined('PATH_RESOURCES')) { |
|
| 349 | + } elseif (strpos($path, 'storage') !== false && defined('PATH_RESOURCES')) { |
|
| 350 | 350 | $path_url = 'storage' . '/' . str_replace(PATH_RESOURCES, '', $path); |
| 351 | 351 | } else { |
| 352 | 352 | $path_url = str_replace($base_dir, '', $path); |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | $segments = explode('\\', $class); |
| 422 | 422 | |
| 423 | 423 | if (count($segments) > 1) { |
| 424 | - if ($segments[ 0 ] === $segments[ 1 ]) { |
|
| 424 | + if ($segments[0] === $segments[1]) { |
|
| 425 | 425 | array_shift($segments); |
| 426 | 426 | } |
| 427 | 427 | } |
@@ -494,27 +494,27 @@ discard block |
||
| 494 | 494 | foreach (explode("\n", $raw_headers) as $i => $h) { |
| 495 | 495 | $h = explode(':', $h, 2); |
| 496 | 496 | |
| 497 | - if (isset($h[ 1 ])) { |
|
| 498 | - if ( ! isset($headers[ $h[ 0 ] ])) { |
|
| 499 | - $headers[ $h[ 0 ] ] = trim($h[ 1 ]); |
|
| 500 | - } elseif (is_array($headers[ $h[ 0 ] ])) { |
|
| 501 | - $headers[ $h[ 0 ] ] = array_merge($headers[ $h[ 0 ] ], [trim($h[ 1 ])]); // [+] |
|
| 497 | + if (isset($h[1])) { |
|
| 498 | + if ( ! isset($headers[$h[0]])) { |
|
| 499 | + $headers[$h[0]] = trim($h[1]); |
|
| 500 | + } elseif (is_array($headers[$h[0]])) { |
|
| 501 | + $headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]); // [+] |
|
| 502 | 502 | } else { |
| 503 | - $headers[ $h[ 0 ] ] = array_merge([$headers[ $h[ 0 ] ]], [trim($h[ 1 ])]); // [+] |
|
| 503 | + $headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]); // [+] |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - $key = $h[ 0 ]; // [+] |
|
| 506 | + $key = $h[0]; // [+] |
|
| 507 | 507 | } else // [+] |
| 508 | 508 | { // [+] |
| 509 | - if (substr($h[ 0 ], 0, 1) == "\t") // [+] |
|
| 509 | + if (substr($h[0], 0, 1) == "\t") // [+] |
|
| 510 | 510 | { |
| 511 | - $headers[ $key ] .= "\r\n\t" . trim($h[ 0 ]); |
|
| 511 | + $headers[$key] .= "\r\n\t" . trim($h[0]); |
|
| 512 | 512 | } // [+] |
| 513 | 513 | elseif ( ! $key) // [+] |
| 514 | 514 | { |
| 515 | - $headers[ 0 ] = trim($h[ 0 ]); |
|
| 515 | + $headers[0] = trim($h[0]); |
|
| 516 | 516 | } |
| 517 | - trim($h[ 0 ]); // [+] |
|
| 517 | + trim($h[0]); // [+] |
|
| 518 | 518 | } // [+] |
| 519 | 519 | } |
| 520 | 520 | |
@@ -732,8 +732,8 @@ discard block |
||
| 732 | 732 | |
| 733 | 733 | $string = null; |
| 734 | 734 | |
| 735 | - if (isset($errors[ $code ])) { |
|
| 736 | - $string = $errors[ $code ]; |
|
| 735 | + if (isset($errors[$code])) { |
|
| 736 | + $string = $errors[$code]; |
|
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | return strtoupper($string); |
@@ -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); |
@@ -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 |