. */ namespace App\Services\LogSystem; use InvalidArgumentException; enum EventUndoMode: string { case UNDO = 'undo'; case REVERT = 'revert'; public function toExtraInt(): int { return match ($this) { self::UNDO => 1, self::REVERT => 2, }; } public static function fromExtraInt(int $int): self { return match ($int) { 1 => self::UNDO, 2 => self::REVERT, default => throw new InvalidArgumentException('Invalid int ' . (string) $int . ' for EventUndoMode'), }; } }