| Conditions | 3 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | private function getCacheKey(?string $format, array $context) |
||
| 22 | { |
||
| 23 | foreach ($context[self::EXCLUDE_FROM_CACHE_KEY] ?? $this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] as $key) { |
||
|
|
|||
| 24 | unset($context[$key]); |
||
| 25 | } |
||
| 26 | unset($context[self::EXCLUDE_FROM_CACHE_KEY]); |
||
| 27 | unset($context['cache_key']); // avoid artificially different keys |
||
| 28 | |||
| 29 | try { |
||
| 30 | return md5($format.serialize($context)); |
||
| 31 | } catch (\Exception $exception) { |
||
| 32 | // The context cannot be serialized, skip the cache |
||
| 33 | return false; |
||
| 34 | } |
||
| 37 |