1 | <?php |
||
29 | class Blank implements \Caridea\Validate\Rule |
||
30 | { |
||
31 | /** |
||
32 | * @var string The operator type |
||
33 | */ |
||
34 | private $operator; |
||
35 | |||
36 | /** |
||
37 | * Creates a new EmptyRule. |
||
38 | * |
||
39 | * @param string $operator The operator type |
||
40 | */ |
||
41 | 3 | protected function __construct(string $operator) |
|
45 | |||
46 | /** |
||
47 | * Validates the provided value. |
||
48 | * |
||
49 | * @param mixed $value A value to validate against the rule |
||
50 | * @param array|object $data The dataset which contains this field |
||
51 | * @return array An array of error codes or null if validation succeeded |
||
52 | */ |
||
53 | 3 | public function apply($value, $data = []) |
|
69 | |||
70 | /** |
||
71 | * Gets a rule that requires values to be non-null and not empty string. |
||
72 | * |
||
73 | * @return \Caridea\Validate\Rule\Blank the created rule |
||
74 | */ |
||
75 | 1 | public static function required(): Blank |
|
79 | |||
80 | /** |
||
81 | * Gets a rule that requires strings to be non-empty. |
||
82 | * |
||
83 | * @return \Caridea\Validate\Rule\Blank |
||
84 | */ |
||
85 | 1 | public static function notEmpty(): Blank |
|
89 | |||
90 | /** |
||
91 | * Gets a rule that requires an array or `Countable` to be non-empty. |
||
92 | * |
||
93 | * @return \Caridea\Validate\Rule\Blank |
||
94 | */ |
||
95 | 1 | public static function notEmptyList(): Blank |
|
99 | } |
||
100 |