Completed
Push — 6.0 ( a75685...8c1faf )
by liu
06:09
created
src/think/Http.php 1 patch
Spacing   +27 added lines, -27 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
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     public function __construct(App $app)
60 60
     {
61 61
         $this->app   = $app;
62
-        $this->multi = is_dir($this->app->getBasePath() . 'controller') ? false : true;
62
+        $this->multi = is_dir($this->app->getBasePath().'controller') ? false : true;
63 63
     }
64 64
 
65 65
     /**
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
     protected function dispatchToRoute($request)
197 197
     {
198
-        $withRoute = $this->app->config->get('app.with_route', true) ? function () {
198
+        $withRoute = $this->app->config->get('app.with_route', true) ? function() {
199 199
             $this->loadRoutes();
200 200
         } : null;
201 201
 
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
      */
208 208
     protected function loadMiddleware(): void
209 209
     {
210
-        if (is_file($this->app->getBasePath() . 'middleware.php')) {
211
-            $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php');
210
+        if (is_file($this->app->getBasePath().'middleware.php')) {
211
+            $this->app->middleware->import(include $this->app->getBasePath().'middleware.php');
212 212
         }
213 213
     }
214 214
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         $routePath = $this->getRoutePath();
224 224
 
225 225
         if (is_dir($routePath)) {
226
-            $files = glob($routePath . '*.php');
226
+            $files = glob($routePath.'*.php');
227 227
             foreach ($files as $file) {
228 228
                 include $file;
229 229
             }
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
     protected function getRoutePath(): string
241 241
     {
242 242
         if ($this->app->config->get('route.cross_app_route')) {
243
-            return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR;
243
+            return $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR;
244 244
         }
245 245
 
246
-        if ($this->isMulti() && is_dir($this->app->getAppPath() . 'route')) {
247
-            return $this->app->getAppPath() . 'route' . DIRECTORY_SEPARATOR;
246
+        if ($this->isMulti() && is_dir($this->app->getAppPath().'route')) {
247
+            return $this->app->getAppPath().'route'.DIRECTORY_SEPARATOR;
248 248
         }
249 249
 
250
-        return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . ($this->isMulti() ? $this->getName() . DIRECTORY_SEPARATOR : '');
250
+        return $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.($this->isMulti() ? $this->getName().DIRECTORY_SEPARATOR : '');
251 251
     }
252 252
 
253 253
     /**
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
                         $appName = $map[$name];
339 339
                     }
340 340
                 } elseif ($name && (false !== array_search($name, $map) || in_array($name, $deny))) {
341
-                    throw new HttpException(404, 'app not exists:' . $name);
341
+                    throw new HttpException(404, 'app not exists:'.$name);
342 342
                 } elseif ($name && isset($map['*'])) {
343 343
                     $appName = $map['*'];
344 344
                 } else {
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
                 }
347 347
 
348 348
                 if ($name) {
349
-                    $this->app->request->setRoot('/' . $name);
349
+                    $this->app->request->setRoot('/'.$name);
350 350
                     $this->app->request->setPathinfo(strpos($path, '/') ? ltrim(strstr($path, '/'), '/') : '');
351 351
                 }
352 352
             }
@@ -365,11 +365,11 @@  discard block
 block discarded – undo
365 365
     {
366 366
         $this->name = $appName;
367 367
         $this->app->request->setApp($appName);
368
-        $this->app->setAppPath($this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR);
369
-        $this->app->setRuntimePath($this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR);
368
+        $this->app->setAppPath($this->path ?: $this->app->getBasePath().$appName.DIRECTORY_SEPARATOR);
369
+        $this->app->setRuntimePath($this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$appName.DIRECTORY_SEPARATOR);
370 370
 
371 371
         // 设置应用命名空间
372
-        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\' . $appName);
372
+        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\'.$appName);
373 373
 
374 374
         //加载应用
375 375
         $this->loadApp($appName);
@@ -386,34 +386,34 @@  discard block
 block discarded – undo
386 386
         if (is_dir($this->app->getAppPath())) {
387 387
             $appPath = $this->app->getAppPath();
388 388
 
389
-            if (is_file($appPath . 'common.php')) {
390
-                include_once $appPath . 'common.php';
389
+            if (is_file($appPath.'common.php')) {
390
+                include_once $appPath.'common.php';
391 391
             }
392 392
 
393 393
             $configPath = $this->app->getConfigPath();
394 394
 
395 395
             $files = [];
396 396
 
397
-            if (is_dir($appPath . 'config')) {
398
-                $files = array_merge($files, glob($appPath . 'config' . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
399
-            } elseif (is_dir($configPath . $appName)) {
400
-                $files = array_merge($files, glob($configPath . $appName . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
397
+            if (is_dir($appPath.'config')) {
398
+                $files = array_merge($files, glob($appPath.'config'.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
399
+            } elseif (is_dir($configPath.$appName)) {
400
+                $files = array_merge($files, glob($configPath.$appName.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
401 401
             }
402 402
 
403 403
             foreach ($files as $file) {
404 404
                 $this->app->config->load($file, pathinfo($file, PATHINFO_FILENAME));
405 405
             }
406 406
 
407
-            if (is_file($appPath . 'event.php')) {
408
-                $this->app->loadEvent(include $appPath . 'event.php');
407
+            if (is_file($appPath.'event.php')) {
408
+                $this->app->loadEvent(include $appPath.'event.php');
409 409
             }
410 410
 
411
-            if (is_file($appPath . 'middleware.php')) {
412
-                $this->app->middleware->import(include $appPath . 'middleware.php');
411
+            if (is_file($appPath.'middleware.php')) {
412
+                $this->app->middleware->import(include $appPath.'middleware.php');
413 413
             }
414 414
 
415
-            if (is_file($appPath . 'provider.php')) {
416
-                $this->app->bind(include $appPath . 'provider.php');
415
+            if (is_file($appPath.'provider.php')) {
416
+                $this->app->bind(include $appPath.'provider.php');
417 417
             }
418 418
         }
419 419
 
Please login to merge, or discard this patch.