scanAllAction() operation */ class ScanReport { /** * Date and time of the scan report * @var \DateTime|null */ protected ?\DateTime $datetime = null; /** * Numeric statistics (number of website in each state) * @var array */ protected array $stats = []; /** * Per-site results * @var array */ protected array $results = []; public function __construct() { $this->datetime = new \DateTime(); } /** * @return \DateTime */ public function getDatetime(): \DateTime { return $this->datetime; } /** * @return array */ public function getStats(): array { return $this->stats; } /** * @return array */ public function getLabelledStats(): array { $labelled = []; foreach ($this->stats as $k => $v) { $labelled[SiteStatus::STATUSES[$k]] = $v; } return $labelled; } /** * @return array */ public function getResults(): array { return $this->results; } /** * Set the result associated with the given organization id * * @param int $organizationId * @param SiteStatus $siteStatus */ public function setResultFor(int $organizationId, SiteStatus $siteStatus): void { $this->results[$organizationId] = $siteStatus; if (!isset($this->stats[$siteStatus->getStatusCode()])) { $this->stats[$siteStatus->getStatusCode()] = 0; } $this->stats[$siteStatus->getStatusCode()] += 1; } }