These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\NodeBundle\EventListener; |
||
4 | |||
5 | use Symfony\Component\HttpKernel\Event\FilterResponseEvent; |
||
6 | use Symfony\Component\HttpKernel\Event\GetResponseEvent; |
||
7 | |||
8 | /** |
||
9 | * Fixes bug with date vs Date headers |
||
10 | */ |
||
11 | class FixDateListener |
||
12 | { |
||
13 | /** |
||
14 | * Make sure response has a timestamp |
||
15 | * |
||
16 | * @param FilterResponseEvent|GetResponseEvent $event |
||
0 ignored issues
–
show
Documentation
introduced
by
Loading history...
|
|||
17 | */ |
||
18 | public function onKernelResponse(FilterResponseEvent $event) |
||
19 | { |
||
20 | $response = $event->getResponse(); |
||
21 | if ($response) { |
||
22 | $date = $response->getDate(); |
||
23 | if (null === $date) { |
||
24 | $response->setDate(new \DateTime()); |
||
25 | } |
||
26 | } |
||
27 | } |
||
28 | } |
||
29 |