![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/bundles/StatsBundle/Event/ |
<?php namespace Mautic\StatsBundle\Event; use Mautic\StatsBundle\Aggregate\Collection\StatCollection; use Mautic\StatsBundle\Event\Options\FetchOptions; use Symfony\Contracts\EventDispatcher\Event; class AggregateStatRequestEvent extends Event { private StatCollection $statCollection; /** * @param string $statName */ public function __construct( private $statName, private \DateTimeInterface $fromDateTime, private \DateTimeInterface $toDateTime, private FetchOptions $options ) { $this->statCollection = new StatCollection(); } /** * Note if the listener handled collecting these stats. */ public function statsCollected(): void { $this->stopPropagation(); } /** * @return string */ public function getStatName() { return $this->statName; } /** * @return \DateTimeInterface */ public function getFromDateTime() { return $this->fromDateTime; } /** * @return \DateTimeInterface */ public function getToDateTime() { return $this->toDateTime; } /** * @return FetchOptions */ public function getOptions() { return $this->options; } /** * @return StatCollection */ public function getStatCollection() { return $this->statCollection; } /** * @param string $context */ public function checkContext($context): bool { return $this->statName === $context; } public function checkContexts(array $contexts): bool { return in_array($this->statName, $contexts, true); } /** * @param string $prefix */ public function checkContextPrefix($prefix): bool { return str_starts_with($this->statName, $prefix); } public function checkContextPrefixes(array $prefixes): bool { foreach ($prefixes as $string) { if (str_starts_with($this->statName, $string)) { return true; } } return false; } }