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