@@ -41,17 +41,17 @@ discard block |
||
| 41 | 41 | $this->debug->info('==============================='); |
| 42 | 42 | $this->debug->time('loading application'); |
| 43 | 43 | $appLoader->load(); |
| 44 | - $this->event->exec('application:load-config', [ $this->config ,$this]); |
|
| 44 | + $this->event->exec('application:load-config', [$this->config, $this]); |
|
| 45 | 45 | $this->debug->timeEnd('loading application'); |
| 46 | 46 | $this->debug->time('loading data-source'); |
| 47 | 47 | $appLoader->loadDataSource(); |
| 48 | 48 | Table::load($this); |
| 49 | 49 | DataAccess::load($this); |
| 50 | - $this->event->exec('application:load-environment', [ $this->config ,$this]); |
|
| 50 | + $this->event->exec('application:load-environment', [$this->config, $this]); |
|
| 51 | 51 | $this->debug->timeEnd('loading data-source'); |
| 52 | 52 | $this->debug->time('loading route'); |
| 53 | 53 | $appLoader->loadRoute(); |
| 54 | - $this->event->exec('application:load-route', [$this->route , $this]); |
|
| 54 | + $this->event->exec('application:load-route', [$this->route, $this]); |
|
| 55 | 55 | $this->debug->timeEnd('loading route'); |
| 56 | 56 | $this->debug->info('-------------------------------'); |
| 57 | 57 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | if (!$response->isSended()) { |
| 108 | 108 | $response->end(); |
| 109 | 109 | } |
| 110 | - $this->debug->info('resposned with code '. $response->getStatus()); |
|
| 110 | + $this->debug->info('resposned with code '.$response->getStatus()); |
|
| 111 | 111 | $this->debug->timeEnd('sending response'); |
| 112 | 112 | } catch (Throwable $e) { |
| 113 | 113 | $this->debug->uncaughtException($e); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | protected function createResponse(?MatchResult $result, Request $request, Response $response) |
| 176 | 176 | { |
| 177 | 177 | if (SUDA_DEBUG) { |
| 178 | - $response->setHeader('x-route', $result === null?'default':$result->getName()); |
|
| 178 | + $response->setHeader('x-route', $result === null ? 'default' : $result->getName()); |
|
| 179 | 179 | } |
| 180 | 180 | if ($result === null) { |
| 181 | 181 | $content = $this->defaultResponse($this, $request, $response); |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | protected static function fixConfig(Application $application, ?string $module, array $config) |
| 45 | 45 | { |
| 46 | 46 | if (!array_key_exists('assets-prefix', $config)) { |
| 47 | - $config['assets-prefix'] = defined('SUDA_ASSETS') ? constant('SUDA_ASSETS'): 'assets'; |
|
| 47 | + $config['assets-prefix'] = defined('SUDA_ASSETS') ? constant('SUDA_ASSETS') : 'assets'; |
|
| 48 | 48 | } |
| 49 | 49 | if (!array_key_exists('static', $config)) { |
| 50 | 50 | $config['static'] = 'static'; |
| 51 | 51 | } |
| 52 | 52 | if (!array_key_exists('assets-path', $config)) { |
| 53 | - $config['assets-path'] = SUDA_PUBLIC. '/'.$config['assets-prefix']; |
|
| 53 | + $config['assets-path'] = SUDA_PUBLIC.'/'.$config['assets-prefix']; |
|
| 54 | 54 | } |
| 55 | 55 | if (!array_key_exists('static-name', $config)) { |
| 56 | 56 | $config['uri-name'] = static::getSafeUriName($application, $module); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | $assetRoot = static::getAssetRoot($application, $module); |
| 116 | 116 | if (in_array($request->getIndex(), $application->conf('index', ['/index.php']))) { |
| 117 | - $name = static::writableAssets($application, $module) ? dirname($request->getIndex()):$request->getIndex(); |
|
| 117 | + $name = static::writableAssets($application, $module) ? dirname($request->getIndex()) : $request->getIndex(); |
|
| 118 | 118 | return rtrim(str_replace('\\', '/', $name), '/').$assetRoot; |
| 119 | 119 | } |
| 120 | 120 | return rtrim(str_replace('\\', '/', $request->getIndex()), '/').$assetRoot; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | ?string $module = null |
| 151 | 151 | ):string { |
| 152 | 152 | $assetRoot = static::getAssetRoot($application, $module); |
| 153 | - $name = static::writableAssets($application, $module) ? dirname($request->getIndex()):$request->getIndex(); |
|
| 153 | + $name = static::writableAssets($application, $module) ? dirname($request->getIndex()) : $request->getIndex(); |
|
| 154 | 154 | return rtrim(str_replace('\\', '/', $name), '/').$assetRoot; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | bool $allowQuery = true, |
| 32 | 32 | ?string $default = null, |
| 33 | 33 | ?string $group = null |
| 34 | - ):?string { |
|
| 34 | + ): ?string { |
|
| 35 | 35 | $group = $group ?? $request->getAttribute('group'); |
| 36 | 36 | $default = $default ?? $request->getAttribute('module'); |
| 37 | 37 | $url = $this->route->create($this->getRouteName($name, $default, $group), $parameter, $allowQuery); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | protected function getUrlIndex(Request $request):string |
| 48 | 48 | { |
| 49 | - $indexs = $this->conf('indexs') ?? [ 'index.php' ]; |
|
| 49 | + $indexs = $this->conf('indexs') ?? ['index.php']; |
|
| 50 | 50 | $index = ltrim($request->getIndex(), '/'); |
| 51 | 51 | if (!in_array($index, $indexs)) { |
| 52 | 52 | return $request->getIndex(); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | public function getUribase(Request $request, bool $beautify = true):string |
| 134 | 134 | { |
| 135 | 135 | $index = $beautify ? $this->getUrlIndex($request) : $request->getIndex(); |
| 136 | - return $request->getUribase() . $index; |
|
| 136 | + return $request->getUribase().$index; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -144,6 +144,6 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | protected function getRouteGroupPrefix(?string $group):string |
| 146 | 146 | { |
| 147 | - return $group === null || $group === 'default' ? '': '@'. $group; |
|
| 147 | + return $group === null || $group === 'default' ? '' : '@'.$group; |
|
| 148 | 148 | } |
| 149 | 149 | } |