PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / trunk
Kirki – Freeform Page Builder, Website Builder & Customizer vtrunk
6.3.0 6.2.5 6.2.4 6.2.3 6.2.2 6.2.1 6.2.0 6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / libraries / framework / Validation / Rules / RequiredRule.php
kirki / libraries / framework / Validation / Rules Last commit date
ArrayRule.php 1 month ago BooleanRule.php 1 month ago ConditionalRule.php 1 month ago DateRule.php 1 month ago ExistsRule.php 1 month ago FileRule.php 1 month ago InRule.php 1 month ago NotInRule.php 1 month ago NullableRule.php 1 month ago NumericRule.php 1 month ago ObjectRule.php 1 month ago ProhibitedIfRule.php 1 month ago ProhibitedRule.php 1 month ago ProhibitedUnlessRule.php 1 month ago RequiredIfRule.php 1 month ago RequiredRule.php 1 month ago RequiredUnlessRule.php 1 month ago SameAsRule.php 1 month ago SometimesRule.php 1 month ago StringRule.php 1 month ago UniqueRule.php 1 month ago
RequiredRule.php
58 lines
1 <?php
2
3 /**
4 * Required 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 RequiredRule extends ValidationRule
15 {
16 /**
17 * The rule name.
18 *
19 * @var string
20 *
21 * @since 1.0.0
22 */
23 protected string $rule = 'required';
24 /**
25 * Whether the rule is an implicit rule.
26 *
27 * @var bool
28 *
29 * @since 1.0.0
30 */
31 public bool $is_implicit = \true;
32 /**
33 * Validate the rule.
34 *
35 * @return bool
36 *
37 * @since 1.0.0
38 */
39 public function validate() : bool
40 {
41 if (static::is_nullish($this->value)) {
42 return $this->fails($this->default_messages['default']);
43 }
44 return \true;
45 }
46 /**
47 * Get the error message.
48 *
49 * @return string
50 *
51 * @since 1.0.0
52 */
53 public function messages()
54 {
55 return $this->process_messages($this->messages);
56 }
57 }
58