Conditions | 3 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public static function fromPath(string $confPath): Config |
||
18 | { |
||
19 | $originalConfPath = $confPath; |
||
20 | |||
21 | if (\is_dir($confPath)) { |
||
22 | $confPath = \rtrim($confPath, '/\\') . '/churn.yml'; |
||
23 | } |
||
24 | |||
25 | if (!\is_readable($confPath)) { |
||
26 | throw new InvalidArgumentException('The configuration file can not be read at ' . $originalConfPath); |
||
27 | } |
||
28 | |||
29 | $content = (string) \file_get_contents($confPath); |
||
30 | |||
31 | return Config::create(Yaml::parse($content) ?? []); |
||
32 | } |
||
34 |