$side_effects What the action does beyond its target. * @throws \InvalidArgumentException On a status or side effect outside the vocabulary. */ public function __construct( public readonly string $status, public readonly array $side_effects = array() ) { if ( ! in_array( $status, array( self::REVERSIBLE, self::PARTIALLY_REVERSIBLE, self::IRREVERSIBLE ), true ) ) { throw new \InvalidArgumentException( 'Reversibility is reversible, partially_reversible or irreversible.' ); } foreach ( $side_effects as $effect ) { if ( ! is_string( $effect ) ) { throw new \InvalidArgumentException( 'Side effects are strings.' ); } } } /** * Whether undo may take the action back. */ public function reversible(): bool { return self::REVERSIBLE === $this->status; } }