ArrayRule.php
1 week ago
BooleanRule.php
1 week ago
ConditionalRule.php
1 week ago
DateRule.php
1 week ago
ExistsRule.php
1 week ago
FileRule.php
1 week ago
InRule.php
1 week ago
NotInRule.php
1 week ago
NullableRule.php
1 week ago
NumericRule.php
1 week ago
ObjectRule.php
1 week ago
ProhibitedIfRule.php
1 week ago
ProhibitedRule.php
1 week ago
ProhibitedUnlessRule.php
1 week ago
RequiredIfRule.php
1 week ago
RequiredRule.php
1 week ago
RequiredUnlessRule.php
1 week ago
SameAsRule.php
1 week ago
SometimesRule.php
1 week ago
StringRule.php
1 week ago
UniqueRule.php
1 week ago
SometimesRule.php
47 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Nullable rule class. |
| 5 | * |
| 6 | * @package Framework |
| 7 | * @subpackage Validation |
| 8 | * @since 1.0.0 |
| 9 | */ |
| 10 | namespace Kirki\Framework\Validation\Rules; |
| 11 | |
| 12 | use Kirki\Framework\Validation\ValidationRule; |
| 13 | \defined('ABSPATH') || exit; |
| 14 | class SometimesRule extends ValidationRule |
| 15 | { |
| 16 | /** |
| 17 | * The rule name. |
| 18 | * |
| 19 | * @var string |
| 20 | * |
| 21 | * @since 1.0.0 |
| 22 | */ |
| 23 | protected string $rule = 'sometimes'; |
| 24 | /** |
| 25 | * Validate the rule. |
| 26 | * |
| 27 | * @return bool |
| 28 | * |
| 29 | * @since 1.0.0 |
| 30 | */ |
| 31 | public function validate() : bool |
| 32 | { |
| 33 | return \true; |
| 34 | } |
| 35 | /** |
| 36 | * Get the error message. |
| 37 | * |
| 38 | * @return string |
| 39 | * |
| 40 | * @since 1.0.0 |
| 41 | */ |
| 42 | public function messages() |
| 43 | { |
| 44 | return []; |
| 45 | } |
| 46 | } |
| 47 |