| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace Opentalent\OtAdmin\Domain\Entity;
- /**
- * Report of a ScanController->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;
- }
- }
|