@@ -107,27 +107,27 @@ discard block |
||
107 | 107 | |
108 | 108 | public function testPath() |
109 | 109 | { |
110 | - $rootPath = __DIR__ . DIRECTORY_SEPARATOR; |
|
110 | + $rootPath = __DIR__.DIRECTORY_SEPARATOR; |
|
111 | 111 | |
112 | 112 | $app = new App($rootPath); |
113 | 113 | |
114 | 114 | $this->assertEquals($rootPath, $app->getRootPath()); |
115 | 115 | |
116 | - $this->assertEquals(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $app->getThinkPath()); |
|
116 | + $this->assertEquals(dirname(__DIR__).DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, $app->getThinkPath()); |
|
117 | 117 | |
118 | - $this->assertEquals($rootPath . 'app' . DIRECTORY_SEPARATOR, $app->getAppPath()); |
|
118 | + $this->assertEquals($rootPath.'app'.DIRECTORY_SEPARATOR, $app->getAppPath()); |
|
119 | 119 | |
120 | - $appPath = $rootPath . 'app' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR; |
|
120 | + $appPath = $rootPath.'app'.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR; |
|
121 | 121 | $app->setAppPath($appPath); |
122 | 122 | $this->assertEquals($appPath, $app->getAppPath()); |
123 | 123 | |
124 | - $this->assertEquals($rootPath . 'app' . DIRECTORY_SEPARATOR, $app->getBasePath()); |
|
124 | + $this->assertEquals($rootPath.'app'.DIRECTORY_SEPARATOR, $app->getBasePath()); |
|
125 | 125 | |
126 | - $this->assertEquals($rootPath . 'config' . DIRECTORY_SEPARATOR, $app->getConfigPath()); |
|
126 | + $this->assertEquals($rootPath.'config'.DIRECTORY_SEPARATOR, $app->getConfigPath()); |
|
127 | 127 | |
128 | - $this->assertEquals($rootPath . 'runtime' . DIRECTORY_SEPARATOR, $app->getRuntimePath()); |
|
128 | + $this->assertEquals($rootPath.'runtime'.DIRECTORY_SEPARATOR, $app->getRuntimePath()); |
|
129 | 129 | |
130 | - $runtimePath = $rootPath . 'runtime' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR; |
|
130 | + $runtimePath = $rootPath.'runtime'.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR; |
|
131 | 131 | $app->setRuntimePath($runtimePath); |
132 | 132 | $this->assertEquals($runtimePath, $app->getRuntimePath()); |
133 | 133 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function prepareAppForInitialize(vfsStreamDirectory $root, $debug = true) |
141 | 141 | { |
142 | - $rootPath = $root->url() . DIRECTORY_SEPARATOR; |
|
142 | + $rootPath = $root->url().DIRECTORY_SEPARATOR; |
|
143 | 143 | |
144 | 144 | $app = new App($rootPath); |
145 | 145 | |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | |
149 | 149 | $app->instance($initializer->mockery_getName(), $initializer); |
150 | 150 | |
151 | - (function () use ($initializer) { |
|
151 | + (function() use ($initializer) { |
|
152 | 152 | $this->initializers = [$initializer->mockery_getName()]; |
153 | 153 | })->call($app); |
154 | 154 | |
155 | 155 | $env = m::mock(Env::class); |
156 | - $env->shouldReceive('load')->once()->with($rootPath . '.env'); |
|
156 | + $env->shouldReceive('load')->once()->with($rootPath.'.env'); |
|
157 | 157 | $env->shouldReceive('get')->once()->with('config_ext', '.php')->andReturn('.php'); |
158 | 158 | $env->shouldReceive('get')->once()->with('app_debug')->andReturn($debug); |
159 | 159 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $route = m::mock(Route::class); |
50 | 50 | |
51 | - $route->shouldReceive('dispatch')->withArgs(function ($req, $withRoute) use ($request) { |
|
51 | + $route->shouldReceive('dispatch')->withArgs(function($req, $withRoute) use ($request) { |
|
52 | 52 | if ($withRoute) { |
53 | 53 | $withRoute(); |
54 | 54 | } |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | |
81 | 81 | $this->http->multi(false); |
82 | 82 | |
83 | - $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url() . DIRECTORY_SEPARATOR); |
|
84 | - $this->app->shouldReceive('getRootPath')->andReturn($root->url() . DIRECTORY_SEPARATOR); |
|
83 | + $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url().DIRECTORY_SEPARATOR); |
|
84 | + $this->app->shouldReceive('getRootPath')->andReturn($root->url().DIRECTORY_SEPARATOR); |
|
85 | 85 | |
86 | 86 | $request = m::mock(Request::class)->makePartial(); |
87 | 87 | $response = m::mock(Response::class)->makePartial(); |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | |
141 | 141 | $this->app->shouldReceive('get')->with('config')->andReturn($config); |
142 | 142 | |
143 | - $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url() . DIRECTORY_SEPARATOR); |
|
144 | - $this->app->shouldReceive('getRootPath')->andReturn($root->url() . DIRECTORY_SEPARATOR); |
|
145 | - $this->app->shouldReceive('getConfigPath')->andReturn($root->getChild('config')->url() . DIRECTORY_SEPARATOR); |
|
143 | + $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url().DIRECTORY_SEPARATOR); |
|
144 | + $this->app->shouldReceive('getRootPath')->andReturn($root->url().DIRECTORY_SEPARATOR); |
|
145 | + $this->app->shouldReceive('getConfigPath')->andReturn($root->getChild('config')->url().DIRECTORY_SEPARATOR); |
|
146 | 146 | |
147 | 147 | $response = m::mock(Response::class)->makePartial(); |
148 | 148 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $this->assertTrue($this->http->isBindDomain()); |
175 | 175 | } |
176 | 176 | if ($path) { |
177 | - $this->assertEquals(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR, $this->app->getAppPath()); |
|
177 | + $this->assertEquals(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR, $this->app->getAppPath()); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 |
@@ -8,7 +8,7 @@ |
||
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\middleware; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
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\middleware; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
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\contract; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
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\contract; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: yunwuxin <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\filesystem\driver; |
14 | 14 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: yunwuxin <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think; |
14 | 14 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected function loadRoutesFrom($path) |
38 | 38 | { |
39 | - $this->registerRoutes(function () use ($path) { |
|
39 | + $this->registerRoutes(function() use ($path) { |
|
40 | 40 | include $path; |
41 | 41 | }); |
42 | 42 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | $commands = is_array($commands) ? $commands : func_get_args(); |
61 | 61 | |
62 | - Console::starting(function (Console $console) use ($commands) { |
|
62 | + Console::starting(function(Console $console) use ($commands) { |
|
63 | 63 | $console->addCommands($commands); |
64 | 64 | }); |
65 | 65 | } |
@@ -8,7 +8,7 @@ discard block |
||
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\route; |
14 | 14 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | if ($this->parent && $this->parent->getFullName()) { |
112 | - $this->fullName = $this->parent->getFullName() . ($this->name ? '/' . $this->name : ''); |
|
112 | + $this->fullName = $this->parent->getFullName().($this->name ? '/'.$this->name : ''); |
|
113 | 113 | } else { |
114 | 114 | $this->fullName = $this->name; |
115 | 115 | } |
@@ -304,13 +304,13 @@ discard block |
||
304 | 304 | protected function checkMergeRuleRegex(Request $request, array &$rules, string $url, bool $completeMatch) |
305 | 305 | { |
306 | 306 | $depr = $this->router->config('pathinfo_depr'); |
307 | - $url = $depr . str_replace('|', $depr, $url); |
|
307 | + $url = $depr.str_replace('|', $depr, $url); |
|
308 | 308 | $regex = []; |
309 | 309 | $items = []; |
310 | 310 | |
311 | 311 | foreach ($rules as $key => $item) { |
312 | 312 | if ($item instanceof RuleItem) { |
313 | - $rule = $depr . str_replace('/', $depr, $item->getRule()); |
|
313 | + $rule = $depr.str_replace('/', $depr, $item->getRule()); |
|
314 | 314 | if ($depr == $rule && $depr != $url) { |
315 | 315 | unset($rules[$key]); |
316 | 316 | continue; |
@@ -327,21 +327,21 @@ discard block |
||
327 | 327 | continue; |
328 | 328 | } |
329 | 329 | |
330 | - $slash = preg_quote('/-' . $depr, '/'); |
|
330 | + $slash = preg_quote('/-'.$depr, '/'); |
|
331 | 331 | |
332 | - if ($matchRule = preg_split('/[' . $slash . ']<\w+\??>/', $rule, 2)) { |
|
332 | + if ($matchRule = preg_split('/['.$slash.']<\w+\??>/', $rule, 2)) { |
|
333 | 333 | if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) { |
334 | 334 | unset($rules[$key]); |
335 | 335 | continue; |
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
339 | - if (preg_match_all('/[' . $slash . ']?<?\w+\??>?/', $rule, $matches)) { |
|
339 | + if (preg_match_all('/['.$slash.']?<?\w+\??>?/', $rule, $matches)) { |
|
340 | 340 | unset($rules[$key]); |
341 | 341 | $pattern = array_merge($this->getPattern(), $item->getPattern()); |
342 | 342 | $option = array_merge($this->getOption(), $item->getOption()); |
343 | 343 | |
344 | - $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_' . $key); |
|
344 | + $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_'.$key); |
|
345 | 345 | $items[$key] = $item; |
346 | 346 | } |
347 | 347 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | try { |
355 | - $result = preg_match('/^(?:' . implode('|', $regex) . ')/u', $url, $match); |
|
355 | + $result = preg_match('/^(?:'.implode('|', $regex).')/u', $url, $match); |
|
356 | 356 | } catch (\Exception $e) { |
357 | 357 | throw new Exception('route pattern error'); |
358 | 358 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | |
370 | 370 | if (!isset($pos)) { |
371 | 371 | foreach ($regex as $key => $item) { |
372 | - if (0 === strpos(str_replace(['\/', '\-', '\\' . $depr], ['/', '-', $depr], $item), $match[0])) { |
|
372 | + if (0 === strpos(str_replace(['\/', '\-', '\\'.$depr], ['/', '-', $depr], $item), $match[0])) { |
|
373 | 373 | $pos = $key; |
374 | 374 | break; |
375 | 375 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * @access public |
399 | 399 | * @return RuleItem|null |
400 | 400 | */ |
401 | - public function getMissRule(): ? RuleItem |
|
401 | + public function getMissRule(): ? RuleItem |
|
402 | 402 | { |
403 | 403 | return $this->miss; |
404 | 404 | } |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | public function prefix(string $prefix) |
485 | 485 | { |
486 | 486 | if ($this->parent && $this->parent->getOption('prefix')) { |
487 | - $prefix = $this->parent->getOption('prefix') . $prefix; |
|
487 | + $prefix = $this->parent->getOption('prefix').$prefix; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | return $this->setOption('prefix', $prefix); |