*/ private array $changed = []; /** @var list */ private array $touched = []; /** @var list */ private array $warnings = []; public function __construct(public readonly string $summary) { } /** * A node that still exists after the change: "inserted", "updated", "moved" or "duplicated". * Every action but "moved" counts for the quality warnings. */ public function changed(Block $block, string $action): self { $this->changed[] = [ 'block' => $block, 'id' => null, 'type' => $block->name(), 'action' => $action, 'label' => NodeSummary::label($block), ]; if ($action !== 'moved') { $this->touched[] = $block; } return $this; } /** A node that is gone; $idBefore is its ID before the change. */ public function removed(string $idBefore, Block $block): self { $this->changed[] = [ 'block' => null, 'id' => $idBefore, 'type' => $block->name(), 'action' => 'deleted', 'label' => NodeSummary::label($block), ]; return $this; } public function warning(string $warning): self { $this->warnings[] = $warning; return $this; } /** @return list */ public function entries(): array { return $this->changed; } /** @return list */ public function touched(): array { return $this->touched; } /** @return list */ public function warnings(): array { return $this->warnings; } }