Abstracts
2 years ago
Boolean.php
2 years ago
Currency.php
2 years ago
DateTime.php
2 years ago
Email.php
2 years ago
Exclude.php
2 years ago
ExcludeIf.php
2 years ago
ExcludeUnless.php
2 years ago
In.php
2 years ago
InStrict.php
2 years ago
Integer.php
2 years ago
Max.php
2 years ago
Min.php
2 years ago
Nullable.php
2 years ago
NullableIf.php
2 years ago
NullableUnless.php
2 years ago
Numeric.php
2 years ago
Optional.php
2 years ago
OptionalIf.php
2 years ago
OptionalUnless.php
2 years ago
Required.php
2 years ago
Size.php
2 years ago
Exclude.php
54 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @license GPL-2.0-or-later |
| 4 | * |
| 5 | * Modified by impress-org on 30-October-2023 using Strauss. |
| 6 | * @see https://github.com/BrianHenryIE/strauss |
| 7 | */ |
| 8 | |
| 9 | declare(strict_types=1); |
| 10 | |
| 11 | namespace Give\Vendors\StellarWP\Validation\Rules; |
| 12 | |
| 13 | use Closure; |
| 14 | use Give\Vendors\StellarWP\Validation\Commands\ExcludeValue; |
| 15 | use Give\Vendors\StellarWP\Validation\Contracts\ValidationRule; |
| 16 | |
| 17 | /** |
| 18 | * Applying this rule will prevent all further validations and exclude the value from the validated dataset. |
| 19 | * |
| 20 | * @since 1.2.0 |
| 21 | */ |
| 22 | class Exclude implements ValidationRule |
| 23 | { |
| 24 | /** |
| 25 | * @inheritDoc |
| 26 | * |
| 27 | * @since 1.2.0 |
| 28 | */ |
| 29 | public static function id(): string |
| 30 | { |
| 31 | return 'exclude'; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * @inheritDoc |
| 36 | * |
| 37 | * @since 1.2.0 |
| 38 | */ |
| 39 | public static function fromString(string $options = null): ValidationRule |
| 40 | { |
| 41 | return new self(); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * @inheritDoc |
| 46 | * |
| 47 | * @since 1.2.0 |
| 48 | */ |
| 49 | public function __invoke($value, Closure $fail, string $key, array $values): ExcludeValue |
| 50 | { |
| 51 | return new ExcludeValue(); |
| 52 | } |
| 53 | } |
| 54 |