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
InStrict.php
33 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 | namespace Give\Vendors\StellarWP\Validation\Rules; |
| 10 | |
| 11 | use Closure; |
| 12 | |
| 13 | class InStrict extends In |
| 14 | { |
| 15 | /** |
| 16 | * @since 1.2.0 |
| 17 | */ |
| 18 | public static function id(): string |
| 19 | { |
| 20 | return 'inStrict'; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * @since 1.2.0 |
| 25 | */ |
| 26 | public function __invoke($value, Closure $fail, string $key, array $values) |
| 27 | { |
| 28 | if (!in_array($value, $this->acceptedValues, true)) { |
| 29 | $fail(sprintf(__('%s must be one of %s', 'give'), '{field}', implode(', ', $this->acceptedValues))); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 |