vendor/kunstmaan/node-bundle/EventListener/FixDateListener.php line 15

Open in your IDE?
  1. <?php
  2. namespace Kunstmaan\NodeBundle\EventListener;
  3. use Symfony\Component\HttpKernel\Event\ResponseEvent;
  4. /**
  5.  * Fixes bug with date vs Date headers
  6.  */
  7. class FixDateListener
  8. {
  9.     /**
  10.      * Make sure response has a timestamp
  11.      */
  12.     public function onKernelResponse(ResponseEvent $event)
  13.     {
  14.         $response $event->getResponse();
  15.         if ($response) {
  16.             $date $response->getDate();
  17.             if (null === $date) {
  18.                 $response->setDate(new \DateTime());
  19.             }
  20.         }
  21.     }
  22. }