@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | class ContentWrapper |
| 23 | 23 | { |
| 24 | 24 | protected $types = [ |
| 25 | - [ JsonContentWrapper::class , ['array', JsonSerializable::class],], |
|
| 26 | - [ HtmlContentWrapper::class , ['boolean', 'integer','double', 'string'],], |
|
| 27 | - [ NullContentWrapper::class , ['NULL'],], |
|
| 28 | - [ FileContentWrapper::class , [SplFileObject::class],], |
|
| 25 | + [JsonContentWrapper::class, ['array', JsonSerializable::class], ], |
|
| 26 | + [HtmlContentWrapper::class, ['boolean', 'integer', 'double', 'string'], ], |
|
| 27 | + [NullContentWrapper::class, ['NULL'], ], |
|
| 28 | + [FileContentWrapper::class, [SplFileObject::class], ], |
|
| 29 | 29 | ]; |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public static function isTypeOf($data, string $type) : bool |
| 51 | 51 | { |
| 52 | 52 | if (is_object($data) |
| 53 | - && !in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string','array','NULL'])) { |
|
| 53 | + && !in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string', 'array', 'NULL'])) { |
|
| 54 | 54 | try { |
| 55 | 55 | $class = new ReflectionClass($data); |
| 56 | 56 | $typeRef = new ReflectionClass($type); |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | return ob_get_clean(); |
| 99 | 99 | } |
| 100 | 100 | throw new NoTemplateFoundException( |
| 101 | - 'missing dest at ' . $this->getPath(), |
|
| 101 | + 'missing dest at '.$this->getPath(), |
|
| 102 | 102 | E_USER_ERROR, |
| 103 | 103 | $this->getPath(), |
| 104 | 104 | 1 |
@@ -43,17 +43,17 @@ discard block |
||
| 43 | 43 | $this->debug->info('==============================='); |
| 44 | 44 | $this->debug->time('loading application'); |
| 45 | 45 | $appLoader->load(); |
| 46 | - $this->event->exec('application:load-config', [ $this->config ,$this]); |
|
| 46 | + $this->event->exec('application:load-config', [$this->config, $this]); |
|
| 47 | 47 | $this->debug->timeEnd('loading application'); |
| 48 | 48 | $this->debug->time('loading data-source'); |
| 49 | 49 | $appLoader->loadDataSource(); |
| 50 | 50 | $this->debug->timeEnd('loading data-source'); |
| 51 | 51 | Table::load($this); |
| 52 | 52 | DataAccess::loadApplication($this); |
| 53 | - $this->event->exec('application:load-environment', [ $this->config ,$this]); |
|
| 53 | + $this->event->exec('application:load-environment', [$this->config, $this]); |
|
| 54 | 54 | $this->debug->time('loading route'); |
| 55 | 55 | $appLoader->loadRoute(); |
| 56 | - $this->event->exec('application:load-route', [$this->route , $this]); |
|
| 56 | + $this->event->exec('application:load-route', [$this->route, $this]); |
|
| 57 | 57 | $this->debug->timeEnd('loading route'); |
| 58 | 58 | $this->debug->info('-------------------------------'); |
| 59 | 59 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | if (!$response->isSend()) { |
| 110 | 110 | $response->end(); |
| 111 | 111 | } |
| 112 | - $this->debug->info('responded with code '. $response->getStatus()); |
|
| 112 | + $this->debug->info('responded with code '.$response->getStatus()); |
|
| 113 | 113 | $this->debug->timeEnd('sending response'); |
| 114 | 114 | } catch (Throwable $e) { |
| 115 | 115 | $this->debug->uncaughtException($e); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | protected function createResponse(?MatchResult $result, Request $request, Response $response) |
| 177 | 177 | { |
| 178 | 178 | if (SUDA_DEBUG) { |
| 179 | - $response->setHeader('x-route', $result === null?'default':$result->getName()); |
|
| 179 | + $response->setHeader('x-route', $result === null ? 'default' : $result->getName()); |
|
| 180 | 180 | } |
| 181 | 181 | if ($result === null) { |
| 182 | 182 | $content = $this->defaultResponse($this, $request, $response); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->config = $config; |
| 80 | 80 | $this->name = $name ?? 'anonymous'; |
| 81 | 81 | $this->observer = new NullObserver; |
| 82 | - register_shutdown_function(function () { |
|
| 82 | + register_shutdown_function(function() { |
|
| 83 | 83 | $this->onBeforeSystemShutdown(); |
| 84 | 84 | }); |
| 85 | 85 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | try { |
| 108 | 108 | $this->pdo = $this->createPDO(); |
| 109 | 109 | $this->id = static::$connectionCount; |
| 110 | - static::$connectionCount ++; |
|
| 110 | + static::$connectionCount++; |
|
| 111 | 111 | } catch (PDOException $e) { |
| 112 | 112 | throw new SQLException(sprintf( |
| 113 | 113 | "%s connect database error:%s", |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function beginTransaction() |
| 182 | 182 | { |
| 183 | - $this->transaction ++; |
|
| 183 | + $this->transaction++; |
|
| 184 | 184 | if ($this->transaction == 1) { |
| 185 | 185 | $this->pdo->beginTransaction(); |
| 186 | 186 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | * @param string $query |
| 371 | 371 | * @return string |
| 372 | 372 | */ |
| 373 | - public function prefix( string $query):string |
|
| 373 | + public function prefix(string $query):string |
|
| 374 | 374 | { |
| 375 | 375 | // _:table 前缀控制 |
| 376 | 376 | $prefix = $this->getConfig('prefix', ''); |