Completed
Push — 6.0 ( ac9cfd...3f282c )
by liu
07:24 queued 12s
created
src/think/App.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
 
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
      */
163 163
     public function __construct(string $rootPath = '')
164 164
     {
165
-        $this->thinkPath   = dirname(__DIR__) . DIRECTORY_SEPARATOR;
166
-        $this->rootPath    = $rootPath ? rtrim($rootPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $this->getDefaultRootPath();
167
-        $this->appPath     = $this->rootPath . 'app' . DIRECTORY_SEPARATOR;
168
-        $this->runtimePath = $this->rootPath . 'runtime' . DIRECTORY_SEPARATOR;
165
+        $this->thinkPath   = dirname(__DIR__).DIRECTORY_SEPARATOR;
166
+        $this->rootPath    = $rootPath ? rtrim($rootPath, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR : $this->getDefaultRootPath();
167
+        $this->appPath     = $this->rootPath.'app'.DIRECTORY_SEPARATOR;
168
+        $this->runtimePath = $this->rootPath.'runtime'.DIRECTORY_SEPARATOR;
169 169
 
170
-        if (is_file($this->appPath . 'provider.php')) {
171
-            $this->bind(include $this->appPath . 'provider.php');
170
+        if (is_file($this->appPath.'provider.php')) {
171
+            $this->bind(include $this->appPath.'provider.php');
172 172
         }
173 173
 
174 174
         static::setInstance($this);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     public function getService($service)
229 229
     {
230 230
         $name = is_string($service) ? $service : get_class($service);
231
-        return array_values(array_filter($this->services, function ($value) use ($name) {
231
+        return array_values(array_filter($this->services, function($value) use ($name) {
232 232
             return $value instanceof $name;
233 233
         }, ARRAY_FILTER_USE_BOTH))[0] ?? null;
234 234
     }
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      */
305 305
     public function getBasePath(): string
306 306
     {
307
-        return $this->rootPath . 'app' . DIRECTORY_SEPARATOR;
307
+        return $this->rootPath.'app'.DIRECTORY_SEPARATOR;
308 308
     }
309 309
 
310 310
     /**
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
      */
363 363
     public function getConfigPath(): string
364 364
     {
365
-        return $this->rootPath . 'config' . DIRECTORY_SEPARATOR;
365
+        return $this->rootPath.'config'.DIRECTORY_SEPARATOR;
366 366
     }
367 367
 
368 368
     /**
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
         $this->beginMem  = memory_get_usage();
409 409
 
410 410
         // 加载环境变量
411
-        if (is_file($this->rootPath . '.env')) {
412
-            $this->env->load($this->rootPath . '.env');
411
+        if (is_file($this->rootPath.'.env')) {
412
+            $this->env->load($this->rootPath.'.env');
413 413
         }
414 414
 
415 415
         $this->configExt = $this->env->get('config_ext', '.php');
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         // 加载框架默认语言包
423 423
         $langSet = $this->lang->defaultLangSet();
424 424
 
425
-        $this->lang->load($this->thinkPath . 'lang' . DIRECTORY_SEPARATOR . $langSet . '.php');
425
+        $this->lang->load($this->thinkPath.'lang'.DIRECTORY_SEPARATOR.$langSet.'.php');
426 426
 
427 427
         // 加载应用默认语言包
428 428
         $this->loadLangPack($langSet);
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
         }
462 462
 
463 463
         // 加载系统语言包
464
-        $files = glob($this->appPath . 'lang' . DIRECTORY_SEPARATOR . $langset . '.*');
464
+        $files = glob($this->appPath.'lang'.DIRECTORY_SEPARATOR.$langset.'.*');
465 465
         $this->lang->load($files);
466 466
 
467 467
         // 加载扩展(自定义)语言包
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
      */
480 480
     public function boot(): void
481 481
     {
482
-        array_walk($this->services, function ($service) {
482
+        array_walk($this->services, function($service) {
483 483
             $this->bootService($service);
484 484
         });
485 485
     }
@@ -493,30 +493,30 @@  discard block
 block discarded – undo
493 493
     {
494 494
         $appPath = $this->getAppPath();
495 495
 
496
-        if (is_file($appPath . 'common.php')) {
497
-            include_once $appPath . 'common.php';
496
+        if (is_file($appPath.'common.php')) {
497
+            include_once $appPath.'common.php';
498 498
         }
499 499
 
500
-        include_once $this->thinkPath . 'helper.php';
500
+        include_once $this->thinkPath.'helper.php';
501 501
 
502 502
         $configPath = $this->getConfigPath();
503 503
 
504 504
         $files = [];
505 505
 
506 506
         if (is_dir($configPath)) {
507
-            $files = glob($configPath . '*' . $this->configExt);
507
+            $files = glob($configPath.'*'.$this->configExt);
508 508
         }
509 509
 
510 510
         foreach ($files as $file) {
511 511
             $this->config->load($file, pathinfo($file, PATHINFO_FILENAME));
512 512
         }
513 513
 
514
-        if (is_file($appPath . 'event.php')) {
515
-            $this->loadEvent(include $appPath . 'event.php');
514
+        if (is_file($appPath.'event.php')) {
515
+            $this->loadEvent(include $appPath.'event.php');
516 516
         }
517 517
 
518
-        if (is_file($appPath . 'service.php')) {
519
-            $services = include $appPath . 'service.php';
518
+        if (is_file($appPath.'service.php')) {
519
+            $services = include $appPath.'service.php';
520 520
             foreach ($services as $service) {
521 521
                 $this->register($service);
522 522
             }
@@ -581,9 +581,9 @@  discard block
 block discarded – undo
581 581
         $name  = str_replace(['/', '.'], '\\', $name);
582 582
         $array = explode('\\', $name);
583 583
         $class = Str::studly(array_pop($array));
584
-        $path  = $array ? implode('\\', $array) . '\\' : '';
584
+        $path  = $array ? implode('\\', $array).'\\' : '';
585 585
 
586
-        return $this->namespace . '\\' . $layer . '\\' . $path . $class;
586
+        return $this->namespace.'\\'.$layer.'\\'.$path.$class;
587 587
     }
588 588
 
589 589
     /**
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
     {
605 605
         $path = dirname($this->thinkPath, 4);
606 606
 
607
-        return $path . DIRECTORY_SEPARATOR;
607
+        return $path.DIRECTORY_SEPARATOR;
608 608
     }
609 609
 
610 610
 }
Please login to merge, or discard this patch.