Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
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 | /** @var null|string $payload */ |
||
41 | 2 | $payload = $this->cache->get($cacheKey); |
|
42 | |||
43 | 2 | if ($payload !== null) { |
|
44 | 1 | yield from $this->mapCachePayloadToLoadedRoutes($payload); |
|
45 | |||
46 | 1 | return; |
|
47 | } |
||
48 | |||
49 | 1 | $loadedRoutes = iterator_to_array($this->routeLoader->getRoutes()); |
|
50 | |||
51 | 1 | $this->cache->set($cacheKey, $this->mapLoadedRoutesToCachePayload(...$loadedRoutes)); |
|
52 | |||
53 | 1 | yield from $loadedRoutes; |
|
54 | } |
||
56 |