@@ -18,28 +18,28 @@ |
||
18 | 18 | unset($_SERVER['HTTP_HOST']); |
19 | 19 | unset($_SERVER['SERVER_NAME']); |
20 | 20 | unset($_SERVER['SERVER_PORT']); |
21 | - if (! empty($httpHost)) { |
|
21 | + if (!empty($httpHost)) { |
|
22 | 22 | $_SERVER['HTTP_HOST'] = $httpHost; |
23 | 23 | } |
24 | - if (! empty($serverName)) { |
|
24 | + if (!empty($serverName)) { |
|
25 | 25 | $_SERVER['SERVER_NAME'] = $serverName; |
26 | 26 | } |
27 | - if (! empty($serverPort)) { |
|
27 | + if (!empty($serverPort)) { |
|
28 | 28 | $_SERVER['SERVER_PORT'] = $serverPort; |
29 | 29 | } |
30 | 30 | $domain = new Domain(); |
31 | 31 | $this->assertSame($expected, $domain->toString()); |
32 | 32 | $this->assertSame($expected, $domain->domain()); |
33 | - $this->assertSame($expected, (string)$domain); |
|
33 | + $this->assertSame($expected, (string) $domain); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function domainProvider() |
37 | 37 | { |
38 | 38 | return [ |
39 | - 'simple domain' => [ 'abc.com', 'abc.com', '', 'abc.com' ], |
|
40 | - 'domain with port' => [ 'abc.com:8080', 'abc.com', 8080, 'abc.com' ], |
|
41 | - 'only server_name' => [ '', 'abc.com', 80, 'abc.com' ], |
|
42 | - 'no domain' => [ '', '', '', Domain::DEFAULT_DOMAIN ], |
|
39 | + 'simple domain' => ['abc.com', 'abc.com', '', 'abc.com'], |
|
40 | + 'domain with port' => ['abc.com:8080', 'abc.com', 8080, 'abc.com'], |
|
41 | + 'only server_name' => ['', 'abc.com', 80, 'abc.com'], |
|
42 | + 'no domain' => ['', '', '', Domain::DEFAULT_DOMAIN], |
|
43 | 43 | ]; |
44 | 44 | } |
45 | 45 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | private function detectDomain() : string |
57 | 57 | { |
58 | - if (isset($_SERVER['HTTP_HOST']) && ! empty($_SERVER['HTTP_HOST'])) { |
|
58 | + if (isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) { |
|
59 | 59 | if (isset($_SERVER['SERVER_PORT']) |
60 | 60 | && preg_match('/^(?P<host>.*?):(?P<port>\d+)$/', $_SERVER['HTTP_HOST'], $matches) |
61 | 61 | ) { |
@@ -28,19 +28,19 @@ |
||
28 | 28 | */ |
29 | 29 | public static function configFiles(string $basePath) : array |
30 | 30 | { |
31 | - if (! file_exists($basePath)) { |
|
31 | + if (!file_exists($basePath)) { |
|
32 | 32 | return []; |
33 | 33 | } |
34 | 34 | $domain = new Domain(); |
35 | 35 | $path = $domain->toString(); |
36 | - if (file_exists($e = $basePath . DIRECTORY_SEPARATOR . 'config.php')) { |
|
36 | + if (file_exists($e = $basePath.DIRECTORY_SEPARATOR.'config.php')) { |
|
37 | 37 | $config = include $e; |
38 | 38 | $aliases = $config['los_domain']['aliases'] ?? []; |
39 | 39 | if (array_key_exists($domain->toString(), $aliases)) { |
40 | 40 | $path = $aliases[$domain->toString()]; |
41 | 41 | } |
42 | 42 | } |
43 | - $pattern = $basePath . DIRECTORY_SEPARATOR . $path . '/{{,*.}global,{,*.}local}.php'; |
|
43 | + $pattern = $basePath.DIRECTORY_SEPARATOR.$path.'/{{,*.}global,{,*.}local}.php'; |
|
44 | 44 | return glob($pattern, GLOB_BRACE); |
45 | 45 | } |
46 | 46 | } |