*/ protected array $changes = []; /** * @var array */ protected array $options = []; protected bool $markedChange = false; /** * @param int|string|int[]|string[] $value */ public function addChange(string $key, int|string|array $value): void { $this->changes[$key] = $value; } public function markChange(): void { $this->markedChange = true; } /** * @param string|string[] $values */ public function addOptions(string $key, string|array $values): void { if (!is_array($values)) { $values = [$values]; } $this->options[$key] = $values; } public function hasChanges(): bool { return (count($this->changes) > 0 || $this->markedChange); } /** * @return array{changes:array,options?:array} */ public function getResultArray(): array { $result = []; $result['changes'] = $this->changes; if (count($this->options) > 0) { $result['options'] = $this->options; } return $result; } }