Conditions | 3 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
38 | public function create(string $resourceClass): array |
||
39 | { |
||
40 | $cacheKey = self::CACHE_KEY_PREFIX.str_replace('\\', '', $resourceClass); |
||
41 | |||
42 | try { |
||
43 | $cacheItem = $this->cacheItemPool->getItem($cacheKey); |
||
44 | |||
45 | if ($cacheItem->isHit()) { |
||
46 | return $cacheItem->get(); |
||
47 | } |
||
48 | } catch (CacheException $e) { |
||
49 | return $this->decorated->create($resourceClass); |
||
50 | } |
||
51 | |||
52 | $subresourceOperations = $this->decorated->create($resourceClass); |
||
53 | |||
54 | $cacheItem->set($subresourceOperations); |
||
55 | $this->cacheItemPool->save($cacheItem); |
||
56 | |||
57 | return $subresourceOperations; |
||
58 | } |
||
59 | } |
||
60 |