@@ -17,10 +17,10 @@ |
||
17 | 17 | class ContentWrapper |
18 | 18 | { |
19 | 19 | protected $types = [ |
20 | - [ JsonContentWrapper::class , ['array', JsonSerializable::class],], |
|
21 | - [ HtmlContentWrapper::class , ['boolean', 'integer','double', 'string'],], |
|
22 | - [ NullContentWrapper::class , ['NULL'],], |
|
23 | - [ FileContentWrapper::class , [SplFileObject::class],], |
|
20 | + [ JsonContentWrapper::class , ['array', JsonSerializable::class],], |
|
21 | + [ HtmlContentWrapper::class , ['boolean', 'integer','double', 'string'],], |
|
22 | + [ NullContentWrapper::class , ['NULL'],], |
|
23 | + [ FileContentWrapper::class , [SplFileObject::class],], |
|
24 | 24 | ]; |
25 | 25 | |
26 | 26 | /** |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | class ContentWrapper |
18 | 18 | { |
19 | 19 | protected $types = [ |
20 | - [ JsonContentWrapper::class , ['array', JsonSerializable::class],], |
|
21 | - [ HtmlContentWrapper::class , ['boolean', 'integer','double', 'string'],], |
|
22 | - [ NullContentWrapper::class , ['NULL'],], |
|
23 | - [ FileContentWrapper::class , [SplFileObject::class],], |
|
20 | + [JsonContentWrapper::class, ['array', JsonSerializable::class], ], |
|
21 | + [HtmlContentWrapper::class, ['boolean', 'integer', 'double', 'string'], ], |
|
22 | + [NullContentWrapper::class, ['NULL'], ], |
|
23 | + [FileContentWrapper::class, [SplFileObject::class], ], |
|
24 | 24 | ]; |
25 | 25 | |
26 | 26 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function isTypeOf($data, string $type) : bool |
46 | 46 | { |
47 | - if (is_object($data) && !\in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string','array','NULL'])) { |
|
47 | + if (is_object($data) && !\in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string', 'array', 'NULL'])) { |
|
48 | 48 | $class = new ReflectionClass($data); |
49 | 49 | $typeRef = new ReflectionClass($type); |
50 | 50 | if ($typeRef->isInterface()) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $this->routes = new RouteCollection; |
44 | 44 | $this->runnable = []; |
45 | - $this->default = new Runnable([__CLASS__ , 'defaultResponse']); |
|
45 | + $this->default = new Runnable([__CLASS__, 'defaultResponse']); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param boolean $allowQuery |
290 | 290 | * @return string|null |
291 | 291 | */ |
292 | - public function create(string $name, array $parameter, bool $allowQuery = true):?string |
|
292 | + public function create(string $name, array $parameter, bool $allowQuery = true): ?string |
|
293 | 293 | { |
294 | 294 | if ($matcher = $this->routes->get($name)) { |
295 | 295 | return UriMatcher::buildUri($matcher->getMatcher(), $parameter, $allowQuery); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | public function getDataSourceGroup(string $groupName):DataSource |
86 | 86 | { |
87 | - $group = $groupName === 'default' ? '': '-'. $groupName; |
|
87 | + $group = $groupName === 'default' ? '' : '-'.$groupName; |
|
88 | 88 | $dataSourceConfigPath = $this->application->getResource()->getConfigResourcePath('config/data-source'.$group); |
89 | 89 | $dataSource = new DataSource; |
90 | 90 | $observer = new DebugObserver($this->application->debug()); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | protected function registerModule() |
123 | 123 | { |
124 | - $extractPath = SUDA_DATA .'/extract-module'; |
|
124 | + $extractPath = SUDA_DATA.'/extract-module'; |
|
125 | 125 | FileSystem::make($extractPath); |
126 | 126 | foreach ($this->application->getModulePaths() as $path) { |
127 | 127 | $this->registerModuleFrom($path, $extractPath); |
@@ -19,9 +19,9 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | use FileHelper { |
22 | - delete as protected deleteFile; |
|
23 | - FileHelper::copy insteadof DirectoryHelper; |
|
24 | - FileHelper::move insteadof DirectoryHelper; |
|
22 | + delete as protected deleteFile; |
|
23 | + FileHelper::copy insteadof DirectoryHelper; |
|
24 | + FileHelper::move insteadof DirectoryHelper; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -15,13 +15,13 @@ |
||
15 | 15 | |
16 | 16 | protected function parseStatic($content) |
17 | 17 | { |
18 | - $content = strlen(trim($content)) === 0 ?'()':$content; |
|
18 | + $content = strlen(trim($content)) === 0 ? '()' : $content; |
|
19 | 19 | return '<?php echo $this->getStaticModulePrefix'.$content.'; ?>'; |
20 | 20 | } |
21 | 21 | |
22 | 22 | protected function parseFile($content) |
23 | 23 | { |
24 | - $content = strlen(trim($content)) === 0 ?'()':$content; |
|
24 | + $content = strlen(trim($content)) === 0 ? '()' : $content; |
|
25 | 25 | return '<?php echo $this->getModulePrefix'.$content.'; ?>'; |
26 | 26 | } |
27 | 27 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | protected function getModuleStaticOutpath(?string $module) |
97 | 97 | { |
98 | 98 | $config = $this->getModuleConfig($module); |
99 | - $path = $config['assets-path'].'/'. $this->getModuleUriName($module) .'/'.$config['static']; |
|
99 | + $path = $config['assets-path'].'/'.$this->getModuleUriName($module).'/'.$config['static']; |
|
100 | 100 | FileSystem::make($path); |
101 | 101 | return $path; |
102 | 102 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | $this->prepareStaticModuleSource($module); |
126 | 126 | $config = TemplateUtil::getConfig($this->application, $module); |
127 | - return $this->getModuleStaticAssetRoot($module) .'/'.$this->getModuleUriName($module). '/'.$config['static']; |
|
127 | + return $this->getModuleStaticAssetRoot($module).'/'.$this->getModuleUriName($module).'/'.$config['static']; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | protected function getModulePrefix(?string $module = null) |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | if ($module === null) { |
133 | 133 | $module = $this->module; |
134 | 134 | } |
135 | - return $this->getModuleAssetRoot($module) .'/'.$this->getModuleUriName($module); |
|
135 | + return $this->getModuleAssetRoot($module).'/'.$this->getModuleUriName($module); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | protected function getModuleAssetRoot(?string $module) |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | protected static function fixConfig(Application $application, ?string $module, array $config) |
43 | 43 | { |
44 | 44 | if (!\array_key_exists('assets-prefix', $config)) { |
45 | - $config['assets-prefix'] = defined('SUDA_ASSETS') ? \constant('SUDA_ASSETS'): 'assets'; |
|
45 | + $config['assets-prefix'] = defined('SUDA_ASSETS') ? \constant('SUDA_ASSETS') : 'assets'; |
|
46 | 46 | } |
47 | 47 | if (!\array_key_exists('static', $config)) { |
48 | 48 | $config['static'] = 'static'; |
49 | 49 | } |
50 | 50 | if (!\array_key_exists('assets-path', $config)) { |
51 | - $config['assets-path'] = SUDA_PUBLIC. '/'.$config['assets-prefix']; |
|
51 | + $config['assets-path'] = SUDA_PUBLIC.'/'.$config['assets-prefix']; |
|
52 | 52 | } |
53 | 53 | if (!array_key_exists('static-name', $config)) { |
54 | 54 | $config['uri-name'] = static::getSafeUriName($application, $module); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | $assetRoot = static::getAssetRoot($application, $module); |
112 | 112 | if (in_array($request->getIndex(), $application->conf('index', ['/index.php']))) { |
113 | - $name = static::writableAssets($application, $module) ? dirname($request->getIndex()):$request->getIndex(); |
|
113 | + $name = static::writableAssets($application, $module) ? dirname($request->getIndex()) : $request->getIndex(); |
|
114 | 114 | return rtrim(str_replace('\\', '/', $name), '/').$assetRoot; |
115 | 115 | } |
116 | 116 | return rtrim(str_replace('\\', '/', $request->getIndex()), '/').$assetRoot; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public static function getStaticRequestAsset(Application $application, Request $request, ?string $module = null):string |
144 | 144 | { |
145 | 145 | $assetRoot = static::getAssetRoot($application, $module); |
146 | - $name = static::writableAssets($application, $module) ? dirname($request->getIndex()):$request->getIndex(); |
|
146 | + $name = static::writableAssets($application, $module) ? dirname($request->getIndex()) : $request->getIndex(); |
|
147 | 147 | return rtrim(str_replace('\\', '/', $name), '/').$assetRoot; |
148 | 148 | } |
149 | 149 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param string $path |
71 | 71 | * @return \suda\application\Module|null |
72 | 72 | */ |
73 | - public function guess(string $path):?Module |
|
73 | + public function guess(string $path): ?Module |
|
74 | 74 | { |
75 | 75 | foreach ($this->module as $module) { |
76 | 76 | if (FileSystem::isOverflowPath($module->getPath(), $path) === false) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @throws ApplicationException |
103 | 103 | * @return Module|null |
104 | 104 | */ |
105 | - public function get(string $name):?Module |
|
105 | + public function get(string $name): ?Module |
|
106 | 106 | { |
107 | 107 | $full = $this->getFullName($name); |
108 | 108 | return $this->module[$full]; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if (\array_key_exists($version, $this->knownsFullName[$name])) { |
187 | 187 | return $this->knownsFullName[$name][$version]; |
188 | 188 | } |
189 | - return $hasVersion?$name.':'.$version:end($this->knownsFullName[$name]); |
|
189 | + return $hasVersion ? $name.':'.$version : end($this->knownsFullName[$name]); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | protected function getLikeName(string $name):string |
@@ -263,7 +263,7 @@ |
||
263 | 263 | |
264 | 264 | if ($this->expire !== 0) { |
265 | 265 | $time = $this->fulltime ? $this->expire : time() + $this->expire; |
266 | - $dateTime = \DateTime::createFromFormat('U', $time , new \DateTimeZone('GMT')); |
|
266 | + $dateTime = \DateTime::createFromFormat('U', $time, new \DateTimeZone('GMT')); |
|
267 | 267 | $cookie .= '; expires='.str_replace('+0000', '', $dateTime->format('D, d M Y H:i:s T')); |
268 | 268 | } |
269 | 269 |