mirror of
https://github.com/Respect/Validation.git
synced 2026-03-15 23:05:45 +01:00
28 lines
633 B
PHP
28 lines
633 B
PHP
<?php
|
|
|
|
/*
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Respect\Validation\Rules\Core;
|
|
|
|
use Respect\Validation\Result;
|
|
use Respect\Validation\Rule;
|
|
|
|
abstract class Envelope implements Rule
|
|
{
|
|
/** @param array<string, mixed> $parameters */
|
|
public function __construct(
|
|
private readonly Rule $rule,
|
|
private readonly array $parameters = [],
|
|
) {
|
|
}
|
|
|
|
public function evaluate(mixed $input): Result
|
|
{
|
|
return new Result($this->rule->evaluate($input)->hasPassed, $input, $this, $this->parameters);
|
|
}
|
|
}
|