@@ -88,7 +88,7 @@ |
||
88 | 88 | return ArrayDotAccess::exist($this->config, $name); |
89 | 89 | } |
90 | 90 | |
91 | - public function loadConfig(string $path, array $extra = []):?array |
|
91 | + public function loadConfig(string $path, array $extra = []): ?array |
|
92 | 92 | { |
93 | 93 | $data = null; |
94 | 94 | if (!file_exists($path)) { |
@@ -45,13 +45,13 @@ |
||
45 | 45 | |
46 | 46 | protected static function parseValue(string $content, array $extra = []):string |
47 | 47 | { |
48 | - return preg_replace_callback('/\$\{(.+?)\}/', function ($matchs) use ($extra) { |
|
48 | + return preg_replace_callback('/\$\{(.+?)\}/', function($matchs) use ($extra) { |
|
49 | 49 | $name = $matchs[1]; |
50 | 50 | if (($value = ArrayDotAccess::get($extra, $name, null)) !== null) { |
51 | 51 | } elseif (defined($name)) { |
52 | 52 | $value = constant($name); |
53 | 53 | } |
54 | - return is_string($value)?trim(json_encode($value), '"'):$value; |
|
54 | + return is_string($value) ?trim(json_encode($value), '"') : $value; |
|
55 | 55 | }, $content); |
56 | 56 | } |
57 | 57 | } |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | */ |
8 | 8 | class PathResolver |
9 | 9 | { |
10 | - public static function resolve(string $path):?string |
|
10 | + public static function resolve(string $path): ?string |
|
11 | 11 | { |
12 | 12 | if (file_exists($path)) { |
13 | 13 | return $path; |
14 | 14 | } |
15 | 15 | $basepath = dirname($path).'/'.pathinfo($path, PATHINFO_FILENAME); |
16 | 16 | |
17 | - return static::resolveYaml($basepath) ?? static::resolveExtensions($basepath, ['json','php','ini']); |
|
17 | + return static::resolveYaml($basepath) ?? static::resolveExtensions($basepath, ['json', 'php', 'ini']); |
|
18 | 18 | } |
19 | 19 | |
20 | - protected static function resolveYaml(string $basepath):?string |
|
20 | + protected static function resolveYaml(string $basepath): ?string |
|
21 | 21 | { |
22 | 22 | if (file_exists($conf = $basepath.'.yml') || file_exists($conf = $basepath.'.yaml')) { |
23 | 23 | if (function_exists('yaml_parse') || class_exists('Spyc')) { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | return null; |
28 | 28 | } |
29 | 29 | |
30 | - protected static function resolveExtensions(string $basepath, array $extensions):?string |
|
30 | + protected static function resolveExtensions(string $basepath, array $extensions): ?string |
|
31 | 31 | { |
32 | 32 | foreach ($extensions as $ext) { |
33 | 33 | if (file_exists($conf = $basepath.'.'.$ext)) { |