| Total Complexity | 10 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class PathResolver |
||
| 9 | { |
||
| 10 | public static function resolve(string $path):?string |
||
| 11 | { |
||
| 12 | if (file_exists($path)) { |
||
| 13 | return $path; |
||
| 14 | } |
||
| 15 | $basepath = dirname($path).'/'.pathinfo($path, PATHINFO_FILENAME); |
||
| 16 | |||
| 17 | return static::resolveYaml($basepath) ?? static::resolveExtensions($basepath, ['json','php','ini']); |
||
| 18 | } |
||
| 19 | |||
| 20 | protected static function resolveYaml(string $basepath):?string |
||
| 28 | } |
||
| 29 | |||
| 30 | protected static function resolveExtensions(string $basepath, array $extensions):?string |
||
| 38 | } |
||
| 39 | } |
||
| 40 |