Every text written, in order. */ public array $writes = []; /** @param (Closure(string): string)|null $keep What the store really keeps of a written text. */ public function __construct( public string $css = '.a { color: red; }', public string $stylesheet = 'Divi', private ?Closure $keep = null, private bool $refuse = false ) { } public function read(): array { return ['stylesheet' => $this->stylesheet, 'css' => $this->css]; } public function write(string $css): void { if ($this->refuse) { throw new RuntimeException('refused'); } $this->writes[] = $css; $this->css = $this->keep === null ? $css : ($this->keep)($css); } }