@@ -30,10 +30,10 @@ |
||
| 30 | 30 | public function default($packageRoot, Request $request) |
| 31 | 31 | { |
| 32 | 32 | $packageRoot = rtrim($packageRoot, '/'); |
| 33 | - $path = $packageRoot . '/Route/' . $request->route() . '/' . $request->method() . '.php'; |
|
| 33 | + $path = $packageRoot.'/Route/'.$request->route().'/'.$request->method().'.php'; |
|
| 34 | 34 | if (file_exists($path)) { |
| 35 | 35 | require $path; |
| 36 | - $controllerClass = $request->package() . '\\Route_' . str_replace('/', '_', $request->route()) . '\\' . $request->method(); |
|
| 36 | + $controllerClass = $request->package().'\\Route_'.str_replace('/', '_', $request->route()).'\\'.$request->method(); |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * @var BaseController $controller |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | /** |
| 93 | 93 | * Request URL. |
| 94 | 94 | */ |
| 95 | - $this->url = '/' . $url; |
|
| 95 | + $this->url = '/'.$url; |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Get method. |
@@ -129,20 +129,20 @@ discard block |
||
| 129 | 129 | $controller = ''; |
| 130 | 130 | if (false !== strpos($this->url, '.php')) { |
| 131 | 131 | $controller = explode('.php', $this->url); |
| 132 | - $controller = ltrim($controller[0], '/') . '.php'; |
|
| 132 | + $controller = ltrim($controller[0], '/').'.php'; |
|
| 133 | 133 | } |
| 134 | 134 | $route = trim($route, '/'); |
| 135 | 135 | if ('Original' == $this->package) { |
| 136 | 136 | if ($this->languageCode != $this->languageDefault) { |
| 137 | - $url = trim('/' . $this->languageCode . '/' . $route, '/'); |
|
| 137 | + $url = trim('/'.$this->languageCode.'/'.$route, '/'); |
|
| 138 | 138 | } else { |
| 139 | - $url = trim('/' . $route, '/'); |
|
| 139 | + $url = trim('/'.$route, '/'); |
|
| 140 | 140 | } |
| 141 | 141 | } else { |
| 142 | 142 | if ($this->languageCode != $this->languageDefault) { |
| 143 | - $url = trim('/' . $this->languageCode . '/' . lcfirst($this->package) . '/' . $route, '/'); |
|
| 143 | + $url = trim('/'.$this->languageCode.'/'.lcfirst($this->package).'/'.$route, '/'); |
|
| 144 | 144 | } else { |
| 145 | - $url = trim('/' . lcfirst($this->package) . '/' . $route, '/'); |
|
| 145 | + $url = trim('/'.lcfirst($this->package).'/'.$route, '/'); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | if ($domain) { |
@@ -157,22 +157,22 @@ discard block |
||
| 157 | 157 | (isset($_SERVER['SERVER_PORT']) && 443 == $_SERVER['SERVER_PORT']) |
| 158 | 158 | ) { |
| 159 | 159 | if (empty($controller)) { |
| 160 | - $url = 'https://' . $host . '/' . $url; |
|
| 160 | + $url = 'https://'.$host.'/'.$url; |
|
| 161 | 161 | } else { |
| 162 | - $url = 'https://' . $host . '/' . $controller . '/' . $url; |
|
| 162 | + $url = 'https://'.$host.'/'.$controller.'/'.$url; |
|
| 163 | 163 | } |
| 164 | 164 | } else { |
| 165 | 165 | if (empty($controller)) { |
| 166 | - $url = 'http://' . $host . '/' . $url; |
|
| 166 | + $url = 'http://'.$host.'/'.$url; |
|
| 167 | 167 | } else { |
| 168 | - $url = 'http://' . $host . '/' . $controller . '/' . $url; |
|
| 168 | + $url = 'http://'.$host.'/'.$controller.'/'.$url; |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | } else { |
| 172 | 172 | if (empty($controller)) { |
| 173 | - $url = '/' . $url; |
|
| 173 | + $url = '/'.$url; |
|
| 174 | 174 | } else { |
| 175 | - $url = '/' . $controller . '/' . $url; |
|
| 175 | + $url = '/'.$controller.'/'.$url; |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
@@ -32,18 +32,18 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * Register autoload to app/$package/src dir's. |
| 34 | 34 | */ |
| 35 | - spl_autoload_register(function ($path) use ($packageRoot) { |
|
| 36 | - $packageRoot = rtrim($packageRoot, '/') . '/'; |
|
| 35 | + spl_autoload_register(function($path) use ($packageRoot) { |
|
| 36 | + $packageRoot = rtrim($packageRoot, '/').'/'; |
|
| 37 | 37 | $path = explode('\\', $path); |
| 38 | - array_shift($path); // Vendor |
|
| 38 | + array_shift($path); // Vendor |
|
| 39 | 39 | $packageRoot .= array_shift($path); // Package |
| 40 | - $path = $packageRoot . '/src/' . implode('/', $path) . '.php'; |
|
| 40 | + $path = $packageRoot.'/src/'.implode('/', $path).'.php'; |
|
| 41 | 41 | if (file_exists($path)) { |
| 42 | 42 | require_once $path; |
| 43 | 43 | } |
| 44 | 44 | }); |
| 45 | 45 | |
| 46 | - $packageRoot .= $request->package() . '/'; |
|
| 46 | + $packageRoot .= $request->package().'/'; |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Process request. |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * Path to router class. |
| 57 | 57 | */ |
| 58 | - $path = $packageRoot . $request->packageRoute() . '.php'; |
|
| 58 | + $path = $packageRoot.$request->packageRoute().'.php'; |
|
| 59 | 59 | if (file_exists($path)) { |
| 60 | 60 | require $path; |
| 61 | 61 | /** |
| 62 | 62 | * Name of router class. |
| 63 | 63 | */ |
| 64 | - $route = $request->package() . '\\' . $request->packageRoute(); |
|
| 64 | + $route = $request->package().'\\'.$request->packageRoute(); |
|
| 65 | 65 | /** |
| 66 | 66 | * @var BaseRoute $route |
| 67 | 67 | */ |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } else { |
| 73 | 73 | throw new \RuntimeException(sprintf('The file "%s" does not exist', $path)); |
| 74 | 74 | } |
| 75 | - } else { |
|
| 75 | + } else { |
|
| 76 | 76 | $route = new BaseRoute(); |
| 77 | 77 | $route->default($packageRoot, $request); |
| 78 | 78 | if (null !== $route->getResponse()) { |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $response->headerStatus(404); |
| 88 | 88 | |
| 89 | 89 | $content = '404 Not Found'; |
| 90 | - if (file_exists($packageRoot . '/view/404.html.php')) { |
|
| 90 | + if (file_exists($packageRoot.'/view/404.html.php')) { |
|
| 91 | 91 | $template = new Native($packageRoot); |
| 92 | 92 | $content = $template->getContent('404.html.php'); |
| 93 | 93 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function header($name, $value) |
| 72 | 72 | { |
| 73 | 73 | if (!empty($name) && !empty($value) && !headers_sent()) { |
| 74 | - header($name . ': ' . $value); |
|
| 74 | + header($name.': '.$value); |
|
| 75 | 75 | return true; |
| 76 | 76 | } |
| 77 | 77 | return false; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $statusTexts = [ |
| 112 | 112 | 100 => 'Continue', |
| 113 | 113 | 101 => 'Switching Protocols', |
| 114 | - 102 => 'Processing', // RFC2518 |
|
| 114 | + 102 => 'Processing', // RFC2518 |
|
| 115 | 115 | 200 => 'OK', |
| 116 | 116 | 201 => 'Created', |
| 117 | 117 | 202 => 'Accepted', |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | 204 => 'No Content', |
| 120 | 120 | 205 => 'Reset Content', |
| 121 | 121 | 206 => 'Partial Content', |
| 122 | - 207 => 'Multi-Status', // RFC4918 |
|
| 123 | - 208 => 'Already Reported', // RFC5842 |
|
| 124 | - 226 => 'IM Used', // RFC3229 |
|
| 122 | + 207 => 'Multi-Status', // RFC4918 |
|
| 123 | + 208 => 'Already Reported', // RFC5842 |
|
| 124 | + 226 => 'IM Used', // RFC3229 |
|
| 125 | 125 | 300 => 'Multiple Choices', |
| 126 | 126 | 301 => 'Moved Permanently', |
| 127 | 127 | 302 => 'Found', |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | 304 => 'Not Modified', |
| 130 | 130 | 305 => 'Use Proxy', |
| 131 | 131 | 307 => 'Temporary Redirect', |
| 132 | - 308 => 'Permanent Redirect', // RFC7238 |
|
| 132 | + 308 => 'Permanent Redirect', // RFC7238 |
|
| 133 | 133 | 400 => 'Bad Request', |
| 134 | 134 | 401 => 'Unauthorized', |
| 135 | 135 | 402 => 'Payment Required', |
@@ -148,26 +148,26 @@ discard block |
||
| 148 | 148 | 415 => 'Unsupported Media Type', |
| 149 | 149 | 416 => 'Range Not Satisfiable', |
| 150 | 150 | 417 => 'Expectation Failed', |
| 151 | - 418 => 'I\'m a teapot', // RFC2324 |
|
| 152 | - 422 => 'Unprocessable Entity', // RFC4918 |
|
| 153 | - 423 => 'Locked', // RFC4918 |
|
| 154 | - 424 => 'Failed Dependency', // RFC4918 |
|
| 155 | - 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
| 156 | - 426 => 'Upgrade Required', // RFC2817 |
|
| 157 | - 428 => 'Precondition Required', // RFC6585 |
|
| 158 | - 429 => 'Too Many Requests', // RFC6585 |
|
| 159 | - 431 => 'Request Header Fields Too Large', // RFC6585 |
|
| 151 | + 418 => 'I\'m a teapot', // RFC2324 |
|
| 152 | + 422 => 'Unprocessable Entity', // RFC4918 |
|
| 153 | + 423 => 'Locked', // RFC4918 |
|
| 154 | + 424 => 'Failed Dependency', // RFC4918 |
|
| 155 | + 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
| 156 | + 426 => 'Upgrade Required', // RFC2817 |
|
| 157 | + 428 => 'Precondition Required', // RFC6585 |
|
| 158 | + 429 => 'Too Many Requests', // RFC6585 |
|
| 159 | + 431 => 'Request Header Fields Too Large', // RFC6585 |
|
| 160 | 160 | 500 => 'Internal Server Error', |
| 161 | 161 | 501 => 'Not Implemented', |
| 162 | 162 | 502 => 'Bad Gateway', |
| 163 | 163 | 503 => 'Service Unavailable', |
| 164 | 164 | 504 => 'Gateway Timeout', |
| 165 | 165 | 505 => 'HTTP Version Not Supported', |
| 166 | - 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
| 167 | - 507 => 'Insufficient Storage', // RFC4918 |
|
| 168 | - 508 => 'Loop Detected', // RFC5842 |
|
| 169 | - 510 => 'Not Extended', // RFC2774 |
|
| 170 | - 511 => 'Network Authentication Required', // RFC6585 |
|
| 166 | + 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
| 167 | + 507 => 'Insufficient Storage', // RFC4918 |
|
| 168 | + 508 => 'Loop Detected', // RFC5842 |
|
| 169 | + 510 => 'Not Extended', // RFC2774 |
|
| 170 | + 511 => 'Network Authentication Required', // RFC6585 |
|
| 171 | 171 | ]; |
| 172 | 172 | $statusText = $statusTexts[$statusCode]; |
| 173 | 173 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | function redirect($url = null, $statusCode = 302) |
| 189 | 189 | { |
| 190 | 190 | if (null === $url && isset($_SERVER['REQUEST_URI'])) { |
| 191 | - $url = '/' . trim($_SERVER['REQUEST_URI'], '/'); |
|
| 191 | + $url = '/'.trim($_SERVER['REQUEST_URI'], '/'); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (headers_sent()) { |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | </html>', htmlspecialchars($url, ENT_QUOTES, 'UTF-8')); |
| 207 | 207 | |
| 208 | 208 | } else { |
| 209 | - header('Location: ' . $url, true, $statusCode); |
|
| 209 | + header('Location: '.$url, true, $statusCode); |
|
| 210 | 210 | |
| 211 | 211 | echo sprintf('<!DOCTYPE html> |
| 212 | 212 | <html> |
@@ -3,11 +3,11 @@ |
||
| 3 | 3 | * Autoload without composer. |
| 4 | 4 | */ |
| 5 | 5 | $srcRoot = dirname(__FILE__); |
| 6 | -spl_autoload_register(function ($path) use ($srcRoot) { |
|
| 7 | - $root = rtrim($srcRoot, '/') . '/'; |
|
| 6 | +spl_autoload_register(function($path) use ($srcRoot) { |
|
| 7 | + $root = rtrim($srcRoot, '/').'/'; |
|
| 8 | 8 | $path = str_replace('Dspbee\\Test\\', '', $path); |
| 9 | 9 | $path = str_replace('Dspbee\\', '', $path); |
| 10 | - $path = $root . $path . '.php'; |
|
| 10 | + $path = $root.$path.'.php'; |
|
| 11 | 11 | if (file_exists($path)) { |
| 12 | 12 | require_once $path; |
| 13 | 13 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | if (isset($_SERVER[$key])) { |
| 59 | 59 | return $_SERVER[$key]; |
| 60 | 60 | } else { |
| 61 | - $key = 'HTTP_' . $key; |
|
| 61 | + $key = 'HTTP_'.$key; |
|
| 62 | 62 | return $_SERVER[$key] ?? $default; |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | |
| 79 | 79 | // PHP_AUTH_USER/PHP_AUTH_PW |
| 80 | 80 | if (isset($headers['PHP_AUTH_USER'])) { |
| 81 | - $headers['AUTHORIZATION'] = 'Basic ' . base64_encode($headers['PHP_AUTH_USER'] . ':' . $headers['PHP_AUTH_PW']); |
|
| 81 | + $headers['AUTHORIZATION'] = 'Basic '.base64_encode($headers['PHP_AUTH_USER'].':'.$headers['PHP_AUTH_PW']); |
|
| 82 | 82 | } elseif (isset($headers['PHP_AUTH_DIGEST'])) { |
| 83 | 83 | $headers['AUTHORIZATION'] = $headers['PHP_AUTH_DIGEST']; |
| 84 | 84 | } |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | throw new FileException(sprintf('Unable to write in the "%s" directory', $directory)); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - $target = rtrim($directory, '/\\') . DIRECTORY_SEPARATOR . (null === $name ? $this->getBasename() : $this->getName($name)); |
|
| 90 | + $target = rtrim($directory, '/\\').DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name)); |
|
| 91 | 91 | |
| 92 | 92 | return new self($target, false); |
| 93 | 93 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | if ($handle = opendir($root)) { |
| 23 | 23 | while (false !== ($entry = readdir($handle))) { |
| 24 | 24 | if ($entry != "." && $entry != "..") { |
| 25 | - $path = $root . '/' . $entry . '/view/cache'; |
|
| 25 | + $path = $root.'/'.$entry.'/view/cache'; |
|
| 26 | 26 | if (file_exists($path)) { |
| 27 | 27 | self::removeFromDir($path); |
| 28 | 28 | } |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | $objects = scandir($dir); |
| 44 | 44 | foreach ($objects as $object) { |
| 45 | 45 | if ('.' != $object && '..' != $object) { |
| 46 | - if ('dir' == filetype($dir . '/' .$object)) { |
|
| 47 | - self::removeFromDir($dir . '/' . $object, true); |
|
| 46 | + if ('dir' == filetype($dir.'/'.$object)) { |
|
| 47 | + self::removeFromDir($dir.'/'.$object, true); |
|
| 48 | 48 | } else { |
| 49 | - unlink($dir . '/' . $object); |
|
| 49 | + unlink($dir.'/'.$object); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | } |