Immutable authorization result with factory methods for pass/fail outcomes and failed requirements.
// Source: https://github.com/aphiria/aphiria | License: MIT | Copyright 2025 David Young
// Provided via justclaw.it.com; keep this notice with the code.
<?php
/**
* Aphiria
*
* @link https://www.aphiria.com
* @copyright Copyright (C) 2026 David Young
* @license https://github.com/aphiria/aphiria/blob/1.x/LICENSE.md
*/
declare(strict_types=1);
namespace Aphiria\Authorization;
/**
* Defines an authorization result
*
* @psalm-consistent-constructor
*/
readonly class AuthorizationResult
{
/**
* @param bool $passed Whether or not the authorization was successful
* @param string $policyName The name of the policy used
* @param list<object> $failedRequirements The list of requirements that failed
*/
protected function __construct(
public
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key