Files
myep/src/Model/ContentFeed/ContentSyncReport.php
T

43 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Model\ContentFeed;
/**
* What one content sync run did, for the command output and the log.
*/
final class ContentSyncReport
{
public int $added = 0;
public int $deleted = 0;
public int $records = 0;
public int $pages = 0;
/** Records or pages that failed this run. */
public int $failed = 0;
/** Pages left for a later run by the limit outside the night window. */
public int $deferred = 0;
/** Why the run ended early, with nothing after that point fetched. */
public ?string $stoppedBy = null;
/** Why the page phase ended early; the rest of the run completed. */
public ?string $pagePhaseEndedBy = null;
public function isComplete(): bool
{
return null === $this->stoppedBy && null === $this->pagePhaseEndedBy && 0 === $this->deferred;
}
public function changedAnything(): bool
{
return $this->added + $this->deleted + $this->records + $this->pages > 0;
}
/**
* @return array<string, int|string|null>
*/
public function toLogContext(): array
{
return get_object_vars($this);
}
}