Completed
Push — 6.0 ( b9ee63...b796be )
by liu
06:16
created
src/think/Request.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
      */
385 385
     public function domain(bool $port = false): string
386 386
     {
387
-        return $this->scheme() . '://' . $this->host($port);
387
+        return $this->scheme().'://'.$this->host($port);
388 388
     }
389 389
 
390 390
     /**
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
         if (!$root) {
400 400
             $item  = explode('.', $this->host());
401 401
             $count = count($item);
402
-            $root  = $count > 1 ? $item[$count - 2] . '.' . $item[$count - 1] : $item[0];
402
+            $root  = $count > 1 ? $item[$count - 2].'.'.$item[$count - 1] : $item[0];
403 403
         }
404 404
 
405 405
         return $root;
@@ -487,14 +487,14 @@  discard block
 block discarded – undo
487 487
         } elseif ($this->server('REQUEST_URI')) {
488 488
             $url = $this->server('REQUEST_URI');
489 489
         } elseif ($this->server('ORIG_PATH_INFO')) {
490
-            $url = $this->server('ORIG_PATH_INFO') . (!empty($this->server('QUERY_STRING')) ? '?' . $this->server('QUERY_STRING') : '');
490
+            $url = $this->server('ORIG_PATH_INFO').(!empty($this->server('QUERY_STRING')) ? '?'.$this->server('QUERY_STRING') : '');
491 491
         } elseif (isset($_SERVER['argv'][1])) {
492 492
             $url = $_SERVER['argv'][1];
493 493
         } else {
494 494
             $url = '';
495 495
         }
496 496
 
497
-        return $complete ? $this->domain() . $url : $url;
497
+        return $complete ? $this->domain().$url : $url;
498 498
     }
499 499
 
500 500
     /**
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
             $this->baseUrl = strpos($str, '?') ? strstr($str, '?', true) : $str;
523 523
         }
524 524
 
525
-        return $complete ? $this->domain() . $this->baseUrl : $this->baseUrl;
525
+        return $complete ? $this->domain().$this->baseUrl : $this->baseUrl;
526 526
     }
527 527
 
528 528
     /**
@@ -543,8 +543,8 @@  discard block
 block discarded – undo
543 543
                     $url = $this->server('PHP_SELF');
544 544
                 } elseif (basename($this->server('ORIG_SCRIPT_NAME')) === $script_name) {
545 545
                     $url = $this->server('ORIG_SCRIPT_NAME');
546
-                } elseif (($pos = strpos($this->server('PHP_SELF'), '/' . $script_name)) !== false) {
547
-                    $url = substr($this->server('SCRIPT_NAME'), 0, $pos) . '/' . $script_name;
546
+                } elseif (($pos = strpos($this->server('PHP_SELF'), '/'.$script_name)) !== false) {
547
+                    $url = substr($this->server('SCRIPT_NAME'), 0, $pos).'/'.$script_name;
548 548
                 } elseif ($this->server('DOCUMENT_ROOT') && strpos($this->server('SCRIPT_FILENAME'), $this->server('DOCUMENT_ROOT')) === 0) {
549 549
                     $url = str_replace('\\', '/', str_replace($this->server('DOCUMENT_ROOT'), '', $this->server('SCRIPT_FILENAME')));
550 550
                 }
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
             $this->baseFile = $url;
553 553
         }
554 554
 
555
-        return $complete ? $this->domain() . $this->baseFile : $this->baseFile;
555
+        return $complete ? $this->domain().$this->baseFile : $this->baseFile;
556 556
     }
557 557
 
558 558
     /**
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
             $this->root = rtrim($file, '/');
584 584
         }
585 585
 
586
-        return $complete ? $this->domain() . $this->root : $this->root;
586
+        return $complete ? $this->domain().$this->root : $this->root;
587 587
     }
588 588
 
589 589
     /**
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
         $root = strpos($base, '.') ? ltrim(dirname($base), DIRECTORY_SEPARATOR) : $base;
598 598
 
599 599
         if ('' != $root) {
600
-            $root = '/' . ltrim($root, '/');
600
+            $root = '/'.ltrim($root, '/');
601 601
         }
602 602
 
603 603
         return $root;
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
                 if (is_scalar($data)) {
1335 1335
                     $data = (string) $data;
1336 1336
                 } else {
1337
-                    throw new \InvalidArgumentException('variable type error:' . gettype($data));
1337
+                    throw new \InvalidArgumentException('variable type error:'.gettype($data));
1338 1338
                 }
1339 1339
                 break;
1340 1340
         }
Please login to merge, or discard this patch.
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
     /**
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
         if (!$this->app->initialized()) {
168 168
             $this->app->initialize();
169 169
             // 加载全局中间件
170
-            if (is_file($this->app->getBasePath() . 'middleware.php')) {
171
-                $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php');
170
+            if (is_file($this->app->getBasePath().'middleware.php')) {
171
+                $this->app->middleware->import(include $this->app->getBasePath().'middleware.php');
172 172
             }
173 173
         }
174 174
     }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         // 监听HttpRun
196 196
         $this->app->event->trigger('HttpRun');
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
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         $routePath = $this->getRoutePath();
214 214
 
215 215
         if (is_dir($routePath)) {
216
-            $files = glob($routePath . '*.php');
216
+            $files = glob($routePath.'*.php');
217 217
             foreach ($files as $file) {
218 218
                 include $file;
219 219
             }
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
      */
230 230
     protected function getRoutePath(): string
231 231
     {
232
-        if ($this->isMulti() && is_dir($this->app->getAppPath() . 'route')) {
233
-            return $this->app->getAppPath() . 'route' . DIRECTORY_SEPARATOR;
232
+        if ($this->isMulti() && is_dir($this->app->getAppPath().'route')) {
233
+            return $this->app->getAppPath().'route'.DIRECTORY_SEPARATOR;
234 234
         }
235 235
 
236
-        return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . ($this->isMulti() ? $this->getName() . DIRECTORY_SEPARATOR : '');
236
+        return $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.($this->isMulti() ? $this->getName().DIRECTORY_SEPARATOR : '');
237 237
     }
238 238
 
239 239
     /**
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                         $appName = $map[$name];
320 320
                     }
321 321
                 } elseif ($name && (false !== array_search($name, $map) || in_array($name, $deny))) {
322
-                    throw new HttpException(404, 'app not exists:' . $name);
322
+                    throw new HttpException(404, 'app not exists:'.$name);
323 323
                 } elseif ($name && isset($map['*'])) {
324 324
                     $appName = $map['*'];
325 325
                 } else {
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
                 }
328 328
 
329 329
                 if ($name) {
330
-                    $this->app->request->setRoot('/' . $name);
330
+                    $this->app->request->setRoot('/'.$name);
331 331
                     $this->app->request->setPathinfo(strpos($path, '/') ? ltrim(strstr($path, '/'), '/') : '');
332 332
                 }
333 333
             }
@@ -347,26 +347,26 @@  discard block
 block discarded – undo
347 347
     {
348 348
         $this->name = $appName;
349 349
         $this->app->request->setApp($appName);
350
-        $this->app->setAppPath($this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR);
351
-        $this->app->setRuntimePath($this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR);
350
+        $this->app->setAppPath($this->path ?: $this->app->getBasePath().$appName.DIRECTORY_SEPARATOR);
351
+        $this->app->setRuntimePath($this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$appName.DIRECTORY_SEPARATOR);
352 352
 
353 353
         //加载app文件
354 354
         if (!isset($this->register[$appName])) {
355 355
             if (is_dir($this->app->getAppPath())) {
356 356
                 $appPath = $this->app->getAppPath();
357 357
 
358
-                if (is_file($appPath . 'common.php')) {
359
-                    include_once $appPath . 'common.php';
358
+                if (is_file($appPath.'common.php')) {
359
+                    include_once $appPath.'common.php';
360 360
                 }
361 361
 
362 362
                 $configPath = $this->app->getConfigPath();
363 363
 
364 364
                 $files = [];
365 365
 
366
-                if (is_dir($configPath . $appName)) {
367
-                    $files = array_merge($files, glob($configPath . $appName . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
368
-                } elseif (is_dir($appPath . 'config')) {
369
-                    $files = array_merge($files, glob($appPath . 'config' . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
366
+                if (is_dir($configPath.$appName)) {
367
+                    $files = array_merge($files, glob($configPath.$appName.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
368
+                } elseif (is_dir($appPath.'config')) {
369
+                    $files = array_merge($files, glob($appPath.'config'.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
370 370
                 }
371 371
 
372 372
                 foreach ($files as $file) {
@@ -375,16 +375,16 @@  discard block
 block discarded – undo
375 375
                     $this->register[$appName]['config'][$name] = $this->app->config->load($file, $name, false);
376 376
                 }
377 377
 
378
-                if (is_file($appPath . 'event.php')) {
379
-                    $this->register[$appName]['event'] = include $appPath . 'event.php';
378
+                if (is_file($appPath.'event.php')) {
379
+                    $this->register[$appName]['event'] = include $appPath.'event.php';
380 380
                 }
381 381
 
382
-                if (is_file($appPath . 'middleware.php')) {
383
-                    $this->register[$appName]['middleware'] = include $appPath . 'middleware.php';
382
+                if (is_file($appPath.'middleware.php')) {
383
+                    $this->register[$appName]['middleware'] = include $appPath.'middleware.php';
384 384
                 }
385 385
 
386
-                if (is_file($appPath . 'provider.php')) {
387
-                    $this->register[$appName]['provider'] = include $appPath . 'provider.php';
386
+                if (is_file($appPath.'provider.php')) {
387
+                    $this->register[$appName]['provider'] = include $appPath.'provider.php';
388 388
                 }
389 389
             }
390 390
         }
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
         $this->app->loadLangPack($this->app->lang->defaultLangSet());
412 412
 
413 413
         // 设置应用命名空间
414
-        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\' . $appName);
414
+        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\'.$appName);
415 415
     }
416 416
 
417 417
     /**
Please login to merge, or discard this patch.