@@ -14,7 +14,7 @@ |
||
| 14 | 14 | { |
| 15 | 15 | (new Run())->pushHandler(\ENV === 'dev' |
| 16 | 16 | ? new PrettyPageHandler() |
| 17 | - : function () { |
|
| 17 | + : function() { |
|
| 18 | 18 | $errorPagePath = $this->getErrorPagePath(); |
| 19 | 19 | if ($errorPagePath && \file_exists($errorPagePath)) { |
| 20 | 20 | echo \file_get_contents($errorPagePath); |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | */ |
| 65 | 65 | protected function configureDispatcher(): Dispatcher |
| 66 | 66 | { |
| 67 | - return \FastRoute\simpleDispatcher(function (RouteCollector $collector) { |
|
| 67 | + return \FastRoute\simpleDispatcher(function(RouteCollector $collector) { |
|
| 68 | 68 | foreach ($this->config as $route) { |
| 69 | 69 | $collector->addRoute($route[0], $route[1], $route[2]); |
| 70 | 70 | } |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | * @var int $k |
| 119 | 119 | * @var array $route |
| 120 | 120 | */ |
| 121 | - foreach ((array)$this->config as $k => $route) { |
|
| 121 | + foreach ((array) $this->config as $k => $route) { |
|
| 122 | 122 | if ($route[1] === $beforeRoute) { |
| 123 | 123 | $k > 1 |
| 124 | 124 | ? \array_splice($this->config, $k, 0, [$routeDefinition]) |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | public function getPath(string $assetClass, $file, bool $absolute = false): string |
| 83 | 83 | { |
| 84 | 84 | if (!isset($this->assets[$assetClass])) { |
| 85 | - throw new Exception('Asset ' . $assetClass . ' is not registered'); |
|
| 85 | + throw new Exception('Asset '.$assetClass.' is not registered'); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | return $absolute |
| 89 | - ? $this->webRoot . $this->getWebDir($this->assets[$assetClass]) . \ltrim($file, '/') |
|
| 90 | - : $this->getWebDir($this->assets[$assetClass]) . \ltrim($file, '/'); |
|
| 89 | + ? $this->webRoot.$this->getWebDir($this->assets[$assetClass]).\ltrim($file, '/') |
|
| 90 | + : $this->getWebDir($this->assets[$assetClass]).\ltrim($file, '/'); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | foreach ($this->assets as $asset) { |
| 100 | 100 | $links = $this->getLinks($asset, $asset->css()); |
| 101 | 101 | foreach ($links as $link) { |
| 102 | - $result[] = '<link rel="stylesheet" href="' . $link . '">'; |
|
| 102 | + $result[] = '<link rel="stylesheet" href="'.$link.'">'; |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | return \implode('', $result); |
@@ -112,16 +112,16 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $result = []; |
| 114 | 114 | foreach ($this->assets as $asset) { |
| 115 | - $productionJs = $this->getWebDir($asset) . self::PRODUCTION_JS; |
|
| 116 | - $productionJsFile = $this->webRoot . $productionJs; |
|
| 115 | + $productionJs = $this->getWebDir($asset).self::PRODUCTION_JS; |
|
| 116 | + $productionJsFile = $this->webRoot.$productionJs; |
|
| 117 | 117 | if ($this->isProduction() && \file_exists($productionJsFile)) { |
| 118 | 118 | $links = $this->getLinks($asset, $asset->externalJs()); |
| 119 | - $links[] = $productionJs . '?' . \filemtime($productionJsFile); |
|
| 119 | + $links[] = $productionJs.'?'.\filemtime($productionJsFile); |
|
| 120 | 120 | } else { |
| 121 | 121 | $links = $this->getLinks($asset, $asset->js()); |
| 122 | 122 | } |
| 123 | 123 | foreach ($links as $link) { |
| 124 | - $result[] = '<script src="' . $link . '"></script>'; |
|
| 124 | + $result[] = '<script src="'.$link.'"></script>'; |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | return \implode('', $result); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | protected function publishAsset(AbstractAsset $asset) |
| 152 | 152 | { |
| 153 | 153 | $hash = $asset->getHash(); |
| 154 | - $dir = $this->webRoot . '/' . $this->assetDirName . '/' . $hash; |
|
| 154 | + $dir = $this->webRoot.'/'.$this->assetDirName.'/'.$hash; |
|
| 155 | 155 | if ($asset->useLinks) { |
| 156 | 156 | if (!$this->filesystem->exists($dir)) { |
| 157 | 157 | $this->filesystem->symlink($asset->getBasePath(), $dir, true); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | private function getWebDir(AbstractAsset $asset): string |
| 174 | 174 | { |
| 175 | 175 | return $asset->publish |
| 176 | - ? '/' . $this->assetDirName . '/' . $asset->getHash() . '/' |
|
| 176 | + ? '/'.$this->assetDirName.'/'.$asset->getHash().'/' |
|
| 177 | 177 | : '/'; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -203,9 +203,9 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | $link = $file; |
| 205 | 205 | if (false === \strpos($file, 'http') && false === \strpos($file, '//')) { |
| 206 | - $filePath = $dir . \ltrim($file, '/'); |
|
| 207 | - $timestamp = \filemtime($this->webRoot . $filePath); |
|
| 208 | - $link = $filePath . '?' . $timestamp; |
|
| 206 | + $filePath = $dir.\ltrim($file, '/'); |
|
| 207 | + $timestamp = \filemtime($this->webRoot.$filePath); |
|
| 208 | + $link = $filePath.'?'.$timestamp; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | return $link; |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | protected function create(string $name): LoggerInterface |
| 53 | 53 | { |
| 54 | 54 | $configLogger = $this->config['logger']; |
| 55 | - $handlers = (array)($configLogger[$name] ?? []); |
|
| 55 | + $handlers = (array) ($configLogger[$name] ?? []); |
|
| 56 | 56 | return new Logger($name, $handlers); |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | */ |
| 58 | 58 | protected function initErrorHandler() |
| 59 | 59 | { |
| 60 | - register_shutdown_function(function(){ |
|
| 60 | + register_shutdown_function(function() { |
|
| 61 | 61 | if ($error = error_get_last()) { |
| 62 | 62 | Log::log(Logger::EMERGENCY, \json_encode($error)); |
| 63 | 63 | } |