@@ -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 | /** |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | class ContentWrapper |
| 22 | 22 | { |
| 23 | 23 | protected $types = [ |
| 24 | - [ JsonContentWrapper::class , ['array', JsonSerializable::class],], |
|
| 25 | - [ HtmlContentWrapper::class , ['boolean', 'integer','double', 'string'],], |
|
| 26 | - [ NullContentWrapper::class , ['NULL'],], |
|
| 27 | - [ FileContentWrapper::class , [SplFileObject::class],], |
|
| 24 | + [JsonContentWrapper::class, ['array', JsonSerializable::class], ], |
|
| 25 | + [HtmlContentWrapper::class, ['boolean', 'integer', 'double', 'string'], ], |
|
| 26 | + [NullContentWrapper::class, ['NULL'], ], |
|
| 27 | + [FileContentWrapper::class, [SplFileObject::class], ], |
|
| 28 | 28 | ]; |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public static function isTypeOf($data, string $type) : bool |
| 51 | 51 | { |
| 52 | - if (is_object($data) && !in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string','array','NULL'])) { |
|
| 52 | + if (is_object($data) && !in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string', 'array', 'NULL'])) { |
|
| 53 | 53 | $class = new ReflectionClass($data); |
| 54 | 54 | $typeRef = new ReflectionClass($type); |
| 55 | 55 | 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); |
@@ -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) |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | public function packValue(?string $matched) |
| 26 | 26 | { |
| 27 | - return $matched ? urlencode($matched): ''; |
|
| 27 | + return $matched ? urlencode($matched) : ''; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | protected function loadRouteGroup(string $groupName) |
| 182 | 182 | { |
| 183 | - $group = $groupName === 'default' ? '': '-'. $groupName; |
|
| 183 | + $group = $groupName === 'default' ? '' : '-'.$groupName; |
|
| 184 | 184 | if ($path = $this->module->getResource()->getConfigResourcePath('config/route'.$group)) { |
| 185 | 185 | $routeConfig = Config::loadConfig($path, [ |
| 186 | 186 | 'module' => $this->module->getName(), |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | protected function loadRouteConfig(string $prefix, string $groupName, array $routeConfig) |
| 206 | 206 | { |
| 207 | - $module = $this->module->getFullName(); |
|
| 207 | + $module = $this->module->getFullName(); |
|
| 208 | 208 | foreach ($routeConfig as $name => $config) { |
| 209 | 209 | $exname = $this->application->getRouteName($name, $module, $groupName); |
| 210 | 210 | $method = $config['method'] ?? []; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | if ($anti) { |
| 219 | 219 | $uri = '/'.trim($uri, '/'); |
| 220 | 220 | } else { |
| 221 | - $uri = '/'.trim($prefix . $uri, '/'); |
|
| 221 | + $uri = '/'.trim($prefix.$uri, '/'); |
|
| 222 | 222 | } |
| 223 | 223 | $this->application->request($method, $exname, $uri, $attriute); |
| 224 | 224 | } |
@@ -230,7 +230,7 @@ |
||
| 230 | 230 | protected function closeOutputBuffer(bool $flush) |
| 231 | 231 | { |
| 232 | 232 | while (ob_get_level() > 0) { |
| 233 | - $flush?ob_end_flush():ob_end_clean(); |
|
| 233 | + $flush ?ob_end_flush() : ob_end_clean(); |
|
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | protected function whereStringArray(string $where, array $whereBinder) |
| 109 | 109 | { |
| 110 | 110 | list($where, $whereBinder) = $this->parepareWhereString($where, $whereBinder); |
| 111 | - $this->where = 'WHERE '. $where; |
|
| 111 | + $this->where = 'WHERE '.$where; |
|
| 112 | 112 | $this->binder = $this->mergeBinder($this->binder, $whereBinder); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function groupBy(string $what) |
| 122 | 122 | { |
| 123 | - $this->groupBy = 'GROUP BY '. $what; |
|
| 123 | + $this->groupBy = 'GROUP BY '.$what; |
|
| 124 | 124 | return $this; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | { |
| 155 | 155 | |
| 156 | 156 | list($having, $havingBinder) = $this->parepareWhereString($having, $havingBinder); |
| 157 | - $this->having = 'HAVING '. $having; |
|
| 157 | + $this->having = 'HAVING '.$having; |
|
| 158 | 158 | $this->binder = $this->mergeBinder($this->binder, $havingBinder); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function orderBy(string $what, string $order = 'ASC') |
| 169 | 169 | { |
| 170 | - $this->orderBy = 'ORDER BY '. $what.' '. $order; |
|
| 170 | + $this->orderBy = 'ORDER BY '.$what.' '.$order; |
|
| 171 | 171 | return $this; |
| 172 | 172 | } |
| 173 | 173 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function limit(int $start, int $length = null) |
| 182 | 182 | { |
| 183 | - $this->limit = 'LIMIT '. $start . ($length !== null ? ',' .$length :''); |
|
| 183 | + $this->limit = 'LIMIT '.$start.($length !== null ? ','.$length : ''); |
|
| 184 | 184 | return $this; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | protected function prepareQuery():Query |
| 209 | 209 | { |
| 210 | - $where = [$this->where,$this->groupBy,$this->having,$this->orderBy,$this->limit]; |
|
| 210 | + $where = [$this->where, $this->groupBy, $this->having, $this->orderBy, $this->limit]; |
|
| 211 | 211 | $condition = implode(' ', array_filter(array_map('trim', $where), 'strlen')); |
| 212 | - $select = [$this->distinct,$this->select]; |
|
| 212 | + $select = [$this->distinct, $this->select]; |
|
| 213 | 213 | $selection = implode(' ', array_filter(array_map('trim', $select), 'strlen')); |
| 214 | 214 | $string = "SELECT {$selection} FROM {$this->table} {$condition}"; |
| 215 | 215 | return new Query($string, $this->binder); |