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