$obligations */ public function __construct( public readonly string $effect, public readonly string $code = '', public readonly string $message = '', public readonly array $obligations = [], ) { } /** * @since 0.1.0 */ public static function allow(string $code = 'allowed'): self { return new self(self::ALLOW, $code); } /** * @since 0.1.0 */ public static function deny(string $code, string $message = ''): self { return new self(self::DENY, $code, $message); } /** * @since 0.1.0 * @param list $obligations */ public static function ask(string $code, string $message = '', array $obligations = []): self { return new self(self::ASK, $code, $message, $obligations); } /** * @since 0.1.0 */ public function allowed(): bool { return $this->effect === self::ALLOW; } /** * @since 0.1.0 */ public function denied(): bool { return $this->effect === self::DENY; } /** * @since 0.1.0 */ public function asks(): bool { return $this->effect === self::ASK; } }