| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | public function getRoutes() : Generator |
||
| 38 | 1 | { |
|
| 39 | $cacheKey = $this->createCacheKey($this->getDirectories()); |
||
| 40 | $payload = $this->cache->get($cacheKey); |
||
| 41 | 1 | ||
| 42 | if ($payload !== null) { |
||
| 43 | 1 | yield from $this->mapCachePayloadToLoadedRoutes($payload); |
|
| 44 | |||
| 45 | 1 | return; |
|
| 46 | 1 | } |
|
| 47 | |||
| 48 | $loadedRoutes = iterator_to_array($this->routeLoader->getRoutes()); |
||
| 49 | |||
| 50 | $this->cache->set($cacheKey, $this->mapLoadedRoutesToCachePayload(...$loadedRoutes)); |
||
| 51 | |||
| 52 | yield from $loadedRoutes; |
||
| 53 | } |
||
| 55 |