Conditions | 6 |
Paths | 5 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 9.1595 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
12 | 1 | public static function resolve(array $directories, ?string $cacheFile): iterable |
|
13 | { |
||
14 | 1 | if ($cacheFile !== null && file_exists($cacheFile)) { |
|
15 | $commandToHandlerMap = Cache::read($cacheFile); |
||
16 | if (count($commandToHandlerMap) > 0) { |
||
17 | return $commandToHandlerMap; |
||
18 | } |
||
19 | } |
||
20 | |||
21 | 1 | $commandToHandlerMap = self::gather($directories); |
|
22 | |||
23 | 1 | if ($cacheFile !== null && is_dir(dirname($cacheFile))) { |
|
24 | Cache::write($cacheFile, $commandToHandlerMap); |
||
25 | } |
||
26 | |||
27 | 1 | return $commandToHandlerMap; |
|
28 | } |
||
29 | |||
40 |