@@ -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 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | /** |
66 | 66 | * Request URL. |
67 | 67 | */ |
68 | - $this->url = '/' . $url; |
|
68 | + $this->url = '/'.$url; |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Get method. |
@@ -32,7 +32,7 @@ |
||
32 | 32 | /** |
33 | 33 | * Get file content. |
34 | 34 | * |
35 | - * @return string|mixed |
|
35 | + * @return string |
|
36 | 36 | */ |
37 | 37 | public function read() |
38 | 38 | { |
@@ -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('Pivasic\\Test\\', '', $path); |
9 | 9 | $path = str_replace('Pivasic\\', '', $path); |
10 | - $path = $root . $path . '.php'; |
|
10 | + $path = $root.$path.'.php'; |
|
11 | 11 | if (file_exists($path)) { |
12 | 12 | require_once $path; |
13 | 13 | } |
@@ -83,7 +83,7 @@ |
||
83 | 83 | throw new FileException(sprintf('Unable to write in the "%s" directory', $directory)); |
84 | 84 | } |
85 | 85 | |
86 | - $target = rtrim($directory, '/\\') . DIRECTORY_SEPARATOR . ('' == $name ? $this->getBasename() : $this->getName($name)); |
|
86 | + $target = rtrim($directory, '/\\').DIRECTORY_SEPARATOR.('' == $name ? $this->getBasename() : $this->getName($name)); |
|
87 | 87 | |
88 | 88 | return new self($target, false); |
89 | 89 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public static function handleFatal() |
48 | 48 | { |
49 | 49 | $error = error_get_last(); |
50 | - if(null !== $error) { |
|
50 | + if (null !== $error) { |
|
51 | 51 | self::render($error["type"], $error["message"], $error["file"], $error["line"]); |
52 | 52 | } |
53 | 53 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | ob_clean(); |
80 | 80 | } |
81 | 81 | $data = [ |
82 | - 'message' => 'From ' . $className . ' ' . $message, |
|
82 | + 'message' => 'From '.$className.' '.$message, |
|
83 | 83 | 'code' => $code, |
84 | 84 | 'file' => $file, |
85 | 85 | 'line' => $line, |
@@ -43,20 +43,20 @@ discard block |
||
43 | 43 | |
44 | 44 | $stack = debug_backtrace(); |
45 | 45 | foreach ($stack as $item) { |
46 | - if (false !== stripos($item['file'], DIRECTORY_SEPARATOR . 'Route' . DIRECTORY_SEPARATOR)) { |
|
47 | - $cacheName = pathinfo($item['file'], PATHINFO_DIRNAME) . '/' . $name; |
|
48 | - $cacheName = explode('Route' . DIRECTORY_SEPARATOR, $cacheName)[1]; |
|
49 | - $cacheName = 'route_' . str_replace(['/', '\\'], '_', $cacheName); |
|
46 | + if (false !== stripos($item['file'], DIRECTORY_SEPARATOR.'Route'.DIRECTORY_SEPARATOR)) { |
|
47 | + $cacheName = pathinfo($item['file'], PATHINFO_DIRNAME).'/'.$name; |
|
48 | + $cacheName = explode('Route'.DIRECTORY_SEPARATOR, $cacheName)[1]; |
|
49 | + $cacheName = 'route_'.str_replace(['/', '\\'], '_', $cacheName); |
|
50 | 50 | break; |
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
54 | - $cacheName .= '_' . $this->language . '.html.php'; |
|
55 | - $path = $this->packageRoot . '/view/_cache/' . str_replace('/', '_', $cacheName); |
|
54 | + $cacheName .= '_'.$this->language.'.html.php'; |
|
55 | + $path = $this->packageRoot.'/view/_cache/'.str_replace('/', '_', $cacheName); |
|
56 | 56 | |
57 | 57 | $exist = file_exists($path); |
58 | 58 | if (!$this->cache || !$exist) { |
59 | - $code = $this->compile($name . '/view.html.php', true, true, true); |
|
59 | + $code = $this->compile($name.'/view.html.php', true, true, true); |
|
60 | 60 | |
61 | 61 | $code = preg_replace(['/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s'], ['>', '<', '\\1'], $code); |
62 | 62 | |
@@ -103,18 +103,18 @@ discard block |
||
103 | 103 | $path = ''; |
104 | 104 | $stack = debug_backtrace(); |
105 | 105 | foreach ($stack as $item) { |
106 | - if (false !== stripos($item['file'], DIRECTORY_SEPARATOR . 'Route' . DIRECTORY_SEPARATOR)) { |
|
107 | - $path = pathinfo($item['file'], PATHINFO_DIRNAME) . '/view.html.php'; |
|
106 | + if (false !== stripos($item['file'], DIRECTORY_SEPARATOR.'Route'.DIRECTORY_SEPARATOR)) { |
|
107 | + $path = pathinfo($item['file'], PATHINFO_DIRNAME).'/view.html.php'; |
|
108 | 108 | if ($processLang) { |
109 | - $storagePath = str_replace('view.html.php', '_lang/' . $this->language . '.php', $path); |
|
109 | + $storagePath = str_replace('view.html.php', '_lang/'.$this->language.'.php', $path); |
|
110 | 110 | } |
111 | 111 | break; |
112 | 112 | } |
113 | 113 | } |
114 | 114 | } else { |
115 | - $path = $this->packageRoot . '/view/' . $name; |
|
115 | + $path = $this->packageRoot.'/view/'.$name; |
|
116 | 116 | if ($processLang) { |
117 | - $storagePath = str_replace('view.html.php', '', $path) . '_lang/' . $this->language . '.php'; |
|
117 | + $storagePath = str_replace('view.html.php', '', $path).'_lang/'.$this->language.'.php'; |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | foreach ($matchList[1] as $key => $template) { |
163 | 163 | if (!empty($matchList[0][$key]) && false !== strpos($code, $matchList[0][$key])) { |
164 | 164 | $template = trim($template); |
165 | - $code = str_replace($matchList[0][$key], $this->compile($template . '/view.html.php', true, true, false), $code); |
|
165 | + $code = str_replace($matchList[0][$key], $this->compile($template.'/view.html.php', true, true, false), $code); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | preg_match_all('/<!-- extends (.*) -->/', $code, $matchList); |
173 | 173 | if (isset($matchList[1][0])) { |
174 | 174 | $template = trim($matchList[1][0]); |
175 | - $parentHtml = $this->compile($template . '/view.html.php', true, true, false); |
|
175 | + $parentHtml = $this->compile($template.'/view.html.php', true, true, false); |
|
176 | 176 | |
177 | 177 | $code = str_replace($matchList[0][0], '', $code); |
178 | 178 | $parentHtml = str_replace('<!-- section -->', $code, $parentHtml); |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | { |
27 | 27 | $packageRoot = rtrim($packageRoot, '/'); |
28 | 28 | $route = preg_replace('/\/\d+/u', '/D', $request->route()); |
29 | - $path = $packageRoot . '/Route/' . $route . '/' . $request->method() . '.php'; |
|
29 | + $path = $packageRoot.'/Route/'.$route.'/'.$request->method().'.php'; |
|
30 | 30 | if (file_exists($path)) { |
31 | 31 | require $path; |
32 | - $controllerClass = $request->package() . '\\Route_' . str_replace('/', '_', $route) . '\\' . $request->method(); |
|
32 | + $controllerClass = $request->package().'\\Route_'.str_replace('/', '_', $route).'\\'.$request->method(); |
|
33 | 33 | /** |
34 | 34 | * @var BaseController $controller |
35 | 35 | */ |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | throw new RouteException(sprintf('Route: the method "%s" does not exist', $handler)); |
51 | 51 | } |
52 | 52 | } else { |
53 | - throw new RouteException(sprintf('Route: path "%s" does not exist', $request->package() . '/Route/' . $route . '/' . $request->method() . '.php')); |
|
53 | + throw new RouteException(sprintf('Route: path "%s" does not exist', $request->package().'/Route/'.$route.'/'.$request->method().'.php')); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
57 | 57 | \ No newline at end of file |