Conditions | 4 |
Paths | 4 |
Total Lines | 12 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
43 | 5 | public function handleDebug(CacheEvent $event) |
|
44 | { |
||
45 | 5 | $response = $event->getResponse(); |
|
46 | 5 | if ($response->headers->has('X-Symfony-Cache')) { |
|
47 | 3 | if (false !== strpos($response->headers->get('X-Symfony-Cache'), 'miss')) { |
|
48 | 1 | $state = 'MISS'; |
|
49 | 2 | } elseif (false !== strpos($response->headers->get('X-Symfony-Cache'), 'fresh')) { |
|
50 | 1 | $state = 'HIT'; |
|
51 | } else { |
||
52 | 1 | $state = 'UNDETERMINED'; |
|
53 | } |
||
54 | 3 | $response->headers->set('X-Cache', $state); |
|
55 | } |
||
58 |