42 lines
1023 B
PHP
42 lines
1023 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Services\TenantConfiguration;
|
|
|
|
final readonly class ExchangePowerShellGateResult
|
|
{
|
|
/**
|
|
* @param array<string, mixed> $context
|
|
*/
|
|
private function __construct(
|
|
public bool $allowed,
|
|
public ?string $reasonCode = null,
|
|
public ?string $failureCode = null,
|
|
public ?string $message = null,
|
|
public array $context = [],
|
|
) {}
|
|
|
|
/**
|
|
* @param array<string, mixed> $context
|
|
*/
|
|
public static function allowed(array $context = []): self
|
|
{
|
|
return new self(allowed: true, context: $context);
|
|
}
|
|
|
|
/**
|
|
* @param array<string, mixed> $context
|
|
*/
|
|
public static function blocked(string $reasonCode, string $failureCode, string $message, array $context = []): self
|
|
{
|
|
return new self(
|
|
allowed: false,
|
|
reasonCode: $reasonCode,
|
|
failureCode: $failureCode,
|
|
message: $message,
|
|
context: $context,
|
|
);
|
|
}
|
|
}
|