Passed
Push — 6.0 ( b796be...8a23b0 )
by liu
06:01
created
src/think/Http.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function __construct(App $app)
64 64
     {
65 65
         $this->app   = $app;
66
-        $this->multi = is_dir($this->app->getBasePath() . 'controller') ? false : true;
66
+        $this->multi = is_dir($this->app->getBasePath().'controller') ? false : true;
67 67
     }
68 68
 
69 69
     /**
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         // 监听HttpRun
192 192
         $this->app->event->trigger('HttpRun');
193 193
 
194
-        $withRoute = $this->app->config->get('app.with_route', true) ? function () {
194
+        $withRoute = $this->app->config->get('app.with_route', true) ? function() {
195 195
             $this->loadRoutes();
196 196
         } : null;
197 197
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         $routePath = $this->getRoutePath();
210 210
 
211 211
         if (is_dir($routePath)) {
212
-            $files = glob($routePath . '*.php');
212
+            $files = glob($routePath.'*.php');
213 213
             foreach ($files as $file) {
214 214
                 include $file;
215 215
             }
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
      */
226 226
     protected function getRoutePath(): string
227 227
     {
228
-        if ($this->isMulti() && is_dir($this->app->getAppPath() . 'route')) {
229
-            return $this->app->getAppPath() . 'route' . DIRECTORY_SEPARATOR;
228
+        if ($this->isMulti() && is_dir($this->app->getAppPath().'route')) {
229
+            return $this->app->getAppPath().'route'.DIRECTORY_SEPARATOR;
230 230
         }
231 231
 
232
-        return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . ($this->isMulti() ? $this->getName() . DIRECTORY_SEPARATOR : '');
232
+        return $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.($this->isMulti() ? $this->getName().DIRECTORY_SEPARATOR : '');
233 233
     }
234 234
 
235 235
     /**
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                         $appName = $map[$name];
316 316
                     }
317 317
                 } elseif ($name && (false !== array_search($name, $map) || in_array($name, $deny))) {
318
-                    throw new HttpException(404, 'app not exists:' . $name);
318
+                    throw new HttpException(404, 'app not exists:'.$name);
319 319
                 } elseif ($name && isset($map['*'])) {
320 320
                     $appName = $map['*'];
321 321
                 } else {
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
                 }
324 324
 
325 325
                 if ($name) {
326
-                    $this->app->request->setRoot('/' . $name);
326
+                    $this->app->request->setRoot('/'.$name);
327 327
                     $this->app->request->setPathinfo(strpos($path, '/') ? ltrim(strstr($path, '/'), '/') : '');
328 328
                 }
329 329
             }
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
     {
344 344
         $this->name = $appName;
345 345
         $this->app->request->setApp($appName);
346
-        $this->app->setAppPath($this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR);
347
-        $this->app->setRuntimePath($this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR);
346
+        $this->app->setAppPath($this->path ?: $this->app->getBasePath().$appName.DIRECTORY_SEPARATOR);
347
+        $this->app->setRuntimePath($this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$appName.DIRECTORY_SEPARATOR);
348 348
 
349 349
         //加载app文件
350 350
         if (!isset($this->register[$appName])) {
@@ -377,31 +377,31 @@  discard block
 block discarded – undo
377 377
         $this->app->loadLangPack($this->app->lang->defaultLangSet());
378 378
 
379 379
         // 设置应用命名空间
380
-        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\' . $appName);
380
+        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\'.$appName);
381 381
     }
382 382
 
383 383
     public function registerApp(string $appName): void
384 384
     {
385 385
         // 加载全局中间件
386
-        if (is_file($this->app->getBasePath() . 'middleware.php')) {
387
-            $this->register[$appName]['global_middleware'] = include $this->app->getBasePath() . 'middleware.php';
386
+        if (is_file($this->app->getBasePath().'middleware.php')) {
387
+            $this->register[$appName]['global_middleware'] = include $this->app->getBasePath().'middleware.php';
388 388
         }
389 389
 
390 390
         if (is_dir($this->app->getAppPath())) {
391 391
             $appPath = $this->app->getAppPath();
392 392
 
393
-            if (is_file($appPath . 'common.php')) {
394
-                include_once $appPath . 'common.php';
393
+            if (is_file($appPath.'common.php')) {
394
+                include_once $appPath.'common.php';
395 395
             }
396 396
 
397 397
             $configPath = $this->app->getConfigPath();
398 398
 
399 399
             $files = [];
400 400
 
401
-            if (is_dir($configPath . $appName)) {
402
-                $files = array_merge($files, glob($configPath . $appName . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
403
-            } elseif (is_dir($appPath . 'config')) {
404
-                $files = array_merge($files, glob($appPath . 'config' . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
401
+            if (is_dir($configPath.$appName)) {
402
+                $files = array_merge($files, glob($configPath.$appName.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
403
+            } elseif (is_dir($appPath.'config')) {
404
+                $files = array_merge($files, glob($appPath.'config'.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
405 405
             }
406 406
 
407 407
             foreach ($files as $file) {
@@ -410,16 +410,16 @@  discard block
 block discarded – undo
410 410
                 $this->register[$appName]['config'][$name] = $this->app->config->load($file, $name, false);
411 411
             }
412 412
 
413
-            if (is_file($appPath . 'event.php')) {
414
-                $this->register[$appName]['event'] = include $appPath . 'event.php';
413
+            if (is_file($appPath.'event.php')) {
414
+                $this->register[$appName]['event'] = include $appPath.'event.php';
415 415
             }
416 416
 
417
-            if (is_file($appPath . 'middleware.php')) {
418
-                $this->register[$appName]['middleware'] = include $appPath . 'middleware.php';
417
+            if (is_file($appPath.'middleware.php')) {
418
+                $this->register[$appName]['middleware'] = include $appPath.'middleware.php';
419 419
             }
420 420
 
421
-            if (is_file($appPath . 'provider.php')) {
422
-                $this->register[$appName]['provider'] = include $appPath . 'provider.php';
421
+            if (is_file($appPath.'provider.php')) {
422
+                $this->register[$appName]['provider'] = include $appPath.'provider.php';
423 423
             }
424 424
         }
425 425
     }
Please login to merge, or discard this patch.