@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | protected static function fixConfig(Application $application, ?string $module, array $config) |
| 45 | 45 | { |
| 46 | 46 | if (!array_key_exists('assets-prefix', $config)) { |
| 47 | - $config['assets-prefix'] = defined('SUDA_ASSETS') ? constant('SUDA_ASSETS'): 'assets'; |
|
| 47 | + $config['assets-prefix'] = defined('SUDA_ASSETS') ? constant('SUDA_ASSETS') : 'assets'; |
|
| 48 | 48 | } |
| 49 | 49 | if (!array_key_exists('static', $config)) { |
| 50 | 50 | $config['static'] = 'static'; |
| 51 | 51 | } |
| 52 | 52 | if (!array_key_exists('assets-path', $config)) { |
| 53 | - $config['assets-path'] = SUDA_PUBLIC. '/'.$config['assets-prefix']; |
|
| 53 | + $config['assets-path'] = SUDA_PUBLIC.'/'.$config['assets-prefix']; |
|
| 54 | 54 | } |
| 55 | 55 | if (!array_key_exists('static-name', $config)) { |
| 56 | 56 | $config['uri-name'] = static::getSafeUriName($application, $module); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $assetRoot = static::getAssetRoot($application, $module); |
| 116 | 116 | if (in_array($request->getIndex(), $application->conf('index', ['/index.php']))) { |
| 117 | 117 | $name = static::isAssetsWritable($application, $module) |
| 118 | - ? dirname($request->getIndex()):$request->getIndex(); |
|
| 118 | + ? dirname($request->getIndex()) : $request->getIndex(); |
|
| 119 | 119 | return rtrim(str_replace('\\', '/', $name), '/').$assetRoot; |
| 120 | 120 | } |
| 121 | 121 | return rtrim(str_replace('\\', '/', $request->getIndex()), '/').$assetRoot; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | ?string $module = null |
| 152 | 152 | ):string { |
| 153 | 153 | $assetRoot = static::getAssetRoot($application, $module); |
| 154 | - $name = static::isAssetsWritable($application, $module) ? dirname($request->getIndex()):$request->getIndex(); |
|
| 154 | + $name = static::isAssetsWritable($application, $module) ? dirname($request->getIndex()) : $request->getIndex(); |
|
| 155 | 155 | return rtrim(str_replace('\\', '/', $name), '/').$assetRoot; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | protected function getStaticOutputPath(?string $name = null) |
| 118 | 118 | { |
| 119 | 119 | $public = defined('SUDA_PUBLIC') ? constant('SUDA_PUBLIC') : '.'; |
| 120 | - $path = $this->config['assets-public'] ?? $public . '/assets/' . $this->getStaticName($name); |
|
| 120 | + $path = $this->config['assets-public'] ?? $public.'/assets/'.$this->getStaticName($name); |
|
| 121 | 121 | FileSystem::make($path); |
| 122 | 122 | return $path; |
| 123 | 123 | } |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | if ($this->isRaw()) { |
| 133 | 133 | return $this->source; |
| 134 | 134 | } |
| 135 | - $output = $this->config['output'] ?? constant('SUDA_DATA') . '/template'; |
|
| 135 | + $output = $this->config['output'] ?? constant('SUDA_DATA').'/template'; |
|
| 136 | 136 | FileSystem::make($output); |
| 137 | - return $output . '/' . $this->name . '-' . substr(md5_file($this->getSourcePath()), 10, 8) . '.php'; |
|
| 137 | + return $output.'/'.$this->name.'-'.substr(md5_file($this->getSourcePath()), 10, 8).'.php'; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $sourcePath = $this->getSourcePath(); |
| 198 | 198 | if ($sourcePath === null) { |
| 199 | 199 | throw new NoTemplateFoundException( |
| 200 | - 'missing source ' . $this->name, |
|
| 200 | + 'missing source '.$this->name, |
|
| 201 | 201 | E_USER_ERROR, |
| 202 | 202 | $this->name, |
| 203 | 203 | NoTemplateFoundException::T_SOURCE |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | public function include(string $path) |
| 251 | 251 | { |
| 252 | 252 | $subfix = $this->config['subfix'] ?? ''; |
| 253 | - $included = new self(Resource::getPathByRelativePath($path . $subfix, dirname($this->source)), $this->config); |
|
| 253 | + $included = new self(Resource::getPathByRelativePath($path.$subfix, dirname($this->source)), $this->config); |
|
| 254 | 254 | $included->parent = $this; |
| 255 | 255 | echo $included->getRenderedString(); |
| 256 | 256 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | } else { |
| 280 | 280 | $prefix = '/assets'; |
| 281 | 281 | } |
| 282 | - return '/' . ltrim($prefix, '/') . '/' . $this->getStaticName($name); |
|
| 282 | + return '/'.ltrim($prefix, '/').'/'.$this->getStaticName($name); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | protected function prepareStaticSource(?string $name = null) |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | } catch (Exception $e) { |
| 325 | - echo '<div style="color:red">' . $e->getMessage() . '</div>'; |
|
| 325 | + echo '<div style="color:red">'.$e->getMessage().'</div>'; |
|
| 326 | 326 | return; |
| 327 | 327 | } |
| 328 | 328 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | echo $included->getRenderedString(); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - private function seekSourcePath():?array |
|
| 44 | + private function seekSourcePath(): ?array |
|
| 45 | 45 | { |
| 46 | 46 | $extArray = []; |
| 47 | 47 | if (array_key_exists('subfix', $this->config)) { |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | $extArray['.php'] = true; |
| 52 | 52 | $resource = $this->getResource($this->module); |
| 53 | 53 | foreach ($extArray as $ext => $isRaw) { |
| 54 | - $path = $resource->getResourcePath($this->getTemplatePath() . '/' . $this->name . $ext); |
|
| 54 | + $path = $resource->getResourcePath($this->getTemplatePath().'/'.$this->name.$ext); |
|
| 55 | 55 | if ($path !== null) { |
| 56 | - return [$path , $isRaw]; |
|
| 56 | + return [$path, $isRaw]; |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | return null; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | $config = $this->getModuleConfig($module); |
| 101 | 101 | $name = $name ?? $this->getModuleConfig($module)['static']; |
| 102 | - $path = $config['assets-path'].'/'. $this->getModuleUriName($module) .'/'.$name; |
|
| 102 | + $path = $config['assets-path'].'/'.$this->getModuleUriName($module).'/'.$name; |
|
| 103 | 103 | FileSystem::make($path); |
| 104 | 104 | return $path; |
| 105 | 105 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $this->prepareStaticModuleSource($module, $name); |
| 129 | 129 | $config = TemplateUtil::getConfig($this->application, $module); |
| 130 | 130 | $name = $name ?? $config['static']; |
| 131 | - return $this->getModuleStaticAssetRoot($module) .'/'.$this->getModuleUriName($module). '/'.$name; |
|
| 131 | + return $this->getModuleStaticAssetRoot($module).'/'.$this->getModuleUriName($module).'/'.$name; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | protected function getModulePrefix(?string $module = null) |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | if ($module === null) { |
| 137 | 137 | $module = $this->module; |
| 138 | 138 | } |
| 139 | - return $this->getModuleAssetRoot($module) .'/'.$this->getModuleUriName($module); |
|
| 139 | + return $this->getModuleAssetRoot($module).'/'.$this->getModuleUriName($module); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | protected function getModuleAssetRoot(?string $module) |