@@ -103,8 +103,8 @@ |
||
| 103 | 103 | */ |
| 104 | 104 | public function setStatus(int $code) |
| 105 | 105 | { |
| 106 | - $this->header->sendHeaderRaw('HTTP/1.1 '.$code.' '. Status::toText($code)); |
|
| 107 | - $this->header->sendHeader('Status', $code.' '. Status::toText($code)); |
|
| 106 | + $this->header->sendHeaderRaw('HTTP/1.1 '.$code.' '.Status::toText($code)); |
|
| 107 | + $this->header->sendHeader('Status', $code.' '.Status::toText($code)); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | class Content |
| 14 | 14 | { |
| 15 | 15 | protected $types = [ |
| 16 | - JsonContent::class => ['boolean','bool','integer','int','float','string','array','null', JsonSerializable::class ], |
|
| 16 | + JsonContent::class => ['boolean', 'bool', 'integer', 'int', 'float', 'string', 'array', 'null', JsonSerializable::class], |
|
| 17 | 17 | FileContent::class => [SplFileInfo::class], |
| 18 | 18 | ]; |
| 19 | 19 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | - if (\method_exists($content,'__toString')) { |
|
| 34 | + if (\method_exists($content, '__toString')) { |
|
| 35 | 35 | return Response::instance()->send($content->__toString()); |
| 36 | 36 | } |
| 37 | 37 | throw new \Exception(sprintf('can not encode %s class to response', get_class($content))); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | private function initBaseConfig() |
| 91 | 91 | { |
| 92 | - $this->initConfigIfNotSet('app.route.active', defined('NEBULA_ROUTE_GROUPS')? \explode(',', \constant('NEBULA_ROUTE_GROUPS')) :['default']); |
|
| 92 | + $this->initConfigIfNotSet('app.route.active', defined('NEBULA_ROUTE_GROUPS') ? \explode(',', \constant('NEBULA_ROUTE_GROUPS')) : ['default']); |
|
| 93 | 93 | $this->initConfigIfNotSet('app.import', [\constant('NEBULA_APP').'/'.'share']); |
| 94 | 94 | $this->initConfigIfNotSet('app.resource', [\constant('NEBULA_APP').'/'.'resource']); |
| 95 | 95 | $this->initConfigIfNotSet('app.module.scan-path', [\constant('NEBULA_APP').'/'.'modules']); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | private function initTimezone() |
| 118 | 118 | { |
| 119 | - $timezone = defined('DEFAULT_TIMEZONE')?constant('DEFAULT_TIMEZONE'):'PRC'; |
|
| 119 | + $timezone = defined('DEFAULT_TIMEZONE') ?constant('DEFAULT_TIMEZONE') : 'PRC'; |
|
| 120 | 120 | date_default_timezone_set($this->config->get('app.timezone', $timezone)); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public function run() |
| 202 | 202 | { |
| 203 | - $className = $this->config->get('app.application', Application::class); |
|
| 203 | + $className = $this->config->get('app.application', Application::class); |
|
| 204 | 204 | $this->application = Runnable::newClassInstance($className); |
| 205 | 205 | $this->application->setContext($this); |
| 206 | 206 | $this->application->setPath($this->path); |
| 207 | 207 | $this->application->setDataPath($this->dataPath); |
| 208 | 208 | $this->application->initialization(); |
| 209 | 209 | Response::instance()->setContext($this); |
| 210 | - Response::instance()->proccess(new Runnable(function(Request $request, Response $response){ |
|
| 210 | + Response::instance()->proccess(new Runnable(function(Request $request, Response $response) { |
|
| 211 | 211 | $response->setStatus(403); |
| 212 | 212 | return ['hello', 'world']; |
| 213 | 213 | }), $this->getRequest()); |