Skip to content
Snippets Groups Projects

phpcs issues fixed

Files
10
@@ -8,6 +8,7 @@ use Drupal\entity_visitors\Service\EntityVisitorsManager;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Drupal\Component\Datetime\TimeInterface;
/**
* A subscriber to the route when it matches an entity route.
@@ -21,11 +22,19 @@ class EntityRouteMatchSubscriber implements EventSubscriberInterface {
*/
private $entityVisitedManager;
/**
* The time service.
*
* @var \Drupal\Component\Datetime\TimeInterface
*/
protected $time;
/**
* {@inheritdoc}
*/
public function __construct(EntityVisitorsManager $entityVisitedManager) {
public function __construct(EntityVisitorsManager $entityVisitedManager, TimeInterface $time) {
$this->entityVisitedManager = $entityVisitedManager;
$this->time = $time;
}
/**
@@ -61,7 +70,7 @@ class EntityRouteMatchSubscriber implements EventSubscriberInterface {
$this->entityVisitedManager->handleEntity($routeName, $visitedEntityType, $visitedEntityId);
}
$response->setMaxAge($max_age);
$date = new \DateTime('@' . (\Drupal::time()
$date = new \DateTime('@' . ($this->time
->getRequestTime() + $max_age));
$response->setExpires($date);
}
Loading