@@ -13,11 +13,11 @@ |
||
13 | 13 | { |
14 | 14 | public function __construct(Throwable $exception) |
15 | 15 | { |
16 | - parent::__construct('',[]); |
|
17 | - $this->path = SUDA_RESOURCE. '/error.php'; |
|
16 | + parent::__construct('', []); |
|
17 | + $this->path = SUDA_RESOURCE.'/error.php'; |
|
18 | 18 | $type = get_class($exception); |
19 | 19 | $this->value = [ |
20 | - 'error_type' => $type , |
|
20 | + 'error_type' => $type, |
|
21 | 21 | 'error_sort_type' => strpos($type, '\\') === false ? $type : substr($type, strrpos($type, '\\') + 1), |
22 | 22 | 'error_code' => $exception->getCode(), |
23 | 23 | 'error_message' => $exception->getMessage(), |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function __construct(string $source, array $config = []) |
98 | 98 | { |
99 | - parent::__construct('',[]); |
|
99 | + parent::__construct('', []); |
|
100 | 100 | $this->source = $source; |
101 | 101 | $this->name = pathinfo($source, PATHINFO_FILENAME); |
102 | 102 | $this->config = $config; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | protected function getStaticOutpath() |
111 | 111 | { |
112 | - $path = $this->config['assets-public'] ?? constant('SUDA_PUBLIC').'/assets/'. $this->getStaticName(); |
|
112 | + $path = $this->config['assets-public'] ?? constant('SUDA_PUBLIC').'/assets/'.$this->getStaticName(); |
|
113 | 113 | FileSystem::make($path); |
114 | 114 | return $path; |
115 | 115 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | { |
124 | 124 | $output = $this->config['output'] ?? constant('SUDA_DATA').'/template'; |
125 | 125 | FileSystem::make($output); |
126 | - return $output .'/'. $this->name.'-'.substr(md5_file($this->getSourcePath()), 10, 8).'.php'; |
|
126 | + return $output.'/'.$this->name.'-'.substr(md5_file($this->getSourcePath()), 10, 8).'.php'; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @return string|null |
133 | 133 | */ |
134 | - public function getSourcePath():?string |
|
134 | + public function getSourcePath(): ?string |
|
135 | 135 | { |
136 | 136 | return $this->source ?? null; |
137 | 137 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @return void |
155 | 155 | * @throws Exception |
156 | 156 | */ |
157 | - protected function compile(){ |
|
157 | + protected function compile() { |
|
158 | 158 | $sourcePath = $this->getSourcePath(); |
159 | 159 | $destPath = $this->getPath(); |
160 | 160 | if ($sourcePath === null) { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | public function include(string $path) |
215 | 215 | { |
216 | 216 | $subfix = $this->config['subfix'] ?? ''; |
217 | - $included = new self(Resource::getPathByRelativePath($path. $subfix, dirname($this->source)), $this->config); |
|
217 | + $included = new self(Resource::getPathByRelativePath($path.$subfix, dirname($this->source)), $this->config); |
|
218 | 218 | $included->parent = $this; |
219 | 219 | echo $included->getRenderedString(); |
220 | 220 | } |
@@ -231,13 +231,13 @@ discard block |
||
231 | 231 | { |
232 | 232 | $this->prepareStaticSource(); |
233 | 233 | if (array_key_exists('assets-prefix', $this->config)) { |
234 | - $prefix = $this->config['assets-prefix'] ; |
|
234 | + $prefix = $this->config['assets-prefix']; |
|
235 | 235 | } elseif (defined('SUDA_ASSETS')) { |
236 | 236 | $prefix = constant('SUDA_ASSETS'); |
237 | 237 | } else { |
238 | 238 | $prefix = '/assets'; |
239 | 239 | } |
240 | - return $prefix .'/'.$this->getStaticName(); |
|
240 | + return $prefix.'/'.$this->getStaticName(); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | protected function prepareStaticSource() |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return string|null |
26 | 26 | */ |
27 | - public function getSourcePath():?string |
|
27 | + public function getSourcePath(): ?string |
|
28 | 28 | { |
29 | 29 | $subfix = $this->config['subfix'] ?? '.tpl.html'; |
30 | 30 | return $this->getResource($this->module)->getResourcePath($this->getTemplatePath().'/'.$this->name.$subfix); |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getPath() |
39 | 39 | { |
40 | - $output = $this->config['output'] ?? constant('SUDA_DATA').'/template/'. $this->uriName; |
|
40 | + $output = $this->config['output'] ?? constant('SUDA_DATA').'/template/'.$this->uriName; |
|
41 | 41 | FileSystem::make($output); |
42 | - return $output .'/'. $this->name.'.php'; |
|
42 | + return $output.'/'.$this->name.'.php'; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function getRenderedString() |
61 | 61 | { |
62 | 62 | $this->application->debug()->time('render '.$this->name); |
63 | - $code = parent::getRenderedString(); |
|
63 | + $code = parent::getRenderedString(); |
|
64 | 64 | $this->application->debug()->timeEnd('render '.$this->name); |
65 | 65 | return $code; |
66 | 66 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | } |
77 | 77 | return $this->application->getUrl($this->request, $name, $values ?? [], true, $this->module, $this->group); |
78 | 78 | } elseif (is_array($name) && is_string($defaultName)) { |
79 | - return $this->application->getUrl($this->request, $defaultName, array_merge($this->request->get() ?? [], $name) , true, $this->module, $this->group); |
|
79 | + return $this->application->getUrl($this->request, $defaultName, array_merge($this->request->get() ?? [], $name), true, $this->module, $this->group); |
|
80 | 80 | } elseif (is_string($defaultName)) { |
81 | 81 | return $this->application->getUrl($this->request, $defaultName, $this->request->get() ?? [], true, $this->module, $this->group); |
82 | 82 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | if ($this->request->getAttribute('route') === $full) { |
96 | 96 | if (is_array($parameter)) { |
97 | 97 | foreach ($parameter as $key => $value) { |
98 | - if ($this->request->getQuery($key) != $value){ |
|
98 | + if ($this->request->getQuery($key) != $value) { |
|
99 | 99 | return false; |
100 | 100 | } |
101 | 101 | } |