deblan.io-murph/src/Analytic/DateRangeAnalytic.php
2022-04-19 16:11:51 +02:00

39 lines
784 B
PHP

<?php
namespace App\Analytic;
use App\Core\Analytic\DateRangeAnalytic as BaseDateRangeAnalytic;
/**
* class DateRangeAnalytic.
*
* @author Simon Vieille <simon@deblan.fr>
*/
class DateRangeAnalytic extends BaseDateRangeAnalytic
{
protected string $page;
public function setPath(string $path): self
{
$this->path = $path;
$this->reload = true;
return $this;
}
protected function getEntities(string $type): array
{
$entities = parent::getEntities($type);
foreach ($entities as $key => $entity) {
if ('view' === $type) {
if ($entity->getPath() !== $this->path) {
unset($entities[$key]);
}
}
}
return $entities;
}
}