Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | declare(strict_types=1); |
| 3 | /** |
| 4 | * Pop PHP Framework (https://www.popphp.org/) |
| 5 | * |
| 6 | * @link https://github.com/popphp/popphp-framework |
| 7 | * @author Nick Sagona, III <nick@popphp.org> |
| 8 | * @copyright Copyright (c) 2009-2026 Nick Sagona, III |
| 9 | * @license https://www.popphp.org/license New BSD License |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * @namespace |
| 14 | */ |
| 15 | namespace Pop\Validator; |
| 16 | |
| 17 | /** |
| 18 | * Validator interface |
| 19 | * |
| 20 | * @category Pop |
| 21 | * @package Pop\Validator |
| 22 | * @author Nick Sagona, III <nick@popphp.org> |
| 23 | * @copyright Copyright (c) 2009-2026 Nick Sagona, III |
| 24 | * @license https://www.popphp.org/license New BSD License |
| 25 | * @version 5.0.0 |
| 26 | */ |
| 27 | interface ValidatorInterface |
| 28 | { |
| 29 | |
| 30 | /** |
| 31 | * Get the validator name |
| 32 | * |
| 33 | * @return ?string |
| 34 | */ |
| 35 | public function getName(): ?string; |
| 36 | |
| 37 | /** |
| 38 | * Get the validator description |
| 39 | * |
| 40 | * @return ?string |
| 41 | */ |
| 42 | public function getDescription(): ?string; |
| 43 | |
| 44 | /** |
| 45 | * Get the validator value |
| 46 | * |
| 47 | * @return mixed |
| 48 | */ |
| 49 | public function getValue(): mixed; |
| 50 | |
| 51 | /** |
| 52 | * Get the validator default message |
| 53 | * |
| 54 | * @return string|null |
| 55 | */ |
| 56 | public function getMessage(): string|null; |
| 57 | |
| 58 | /** |
| 59 | * Get the validator input |
| 60 | * |
| 61 | * @return mixed |
| 62 | */ |
| 63 | public function getInput(): mixed; |
| 64 | |
| 65 | /** |
| 66 | * Get the validator field |
| 67 | * |
| 68 | * @param bool $parse |
| 69 | * @return string|array|null |
| 70 | */ |
| 71 | public function getField(bool $parse = true): string|array|null; |
| 72 | |
| 73 | /** |
| 74 | * Get the validator key field value |
| 75 | * |
| 76 | * @return mixed |
| 77 | */ |
| 78 | public function getKeyFieldValue(): mixed; |
| 79 | |
| 80 | /** |
| 81 | * Get the validator results |
| 82 | * |
| 83 | * @return mixed |
| 84 | */ |
| 85 | public function getResults(): mixed; |
| 86 | |
| 87 | /** |
| 88 | * Has validator name |
| 89 | * |
| 90 | * @return bool |
| 91 | */ |
| 92 | public function hasName(): bool; |
| 93 | |
| 94 | /** |
| 95 | * Has validator description |
| 96 | * |
| 97 | * @return bool |
| 98 | */ |
| 99 | public function hasDescription(): bool; |
| 100 | |
| 101 | /** |
| 102 | * Has validator value |
| 103 | * |
| 104 | * @return bool |
| 105 | */ |
| 106 | public function hasValue(): bool; |
| 107 | |
| 108 | /** |
| 109 | * Has validator message |
| 110 | * |
| 111 | * @return bool |
| 112 | */ |
| 113 | public function hasMessage(): bool; |
| 114 | |
| 115 | /** |
| 116 | * Has validator input |
| 117 | * |
| 118 | * @return bool |
| 119 | */ |
| 120 | public function hasInput(): bool; |
| 121 | |
| 122 | /** |
| 123 | * Has validator field |
| 124 | * |
| 125 | * @return bool |
| 126 | */ |
| 127 | public function hasField(): bool; |
| 128 | |
| 129 | /** |
| 130 | * Has validator key field |
| 131 | * |
| 132 | * @return bool |
| 133 | */ |
| 134 | public function hasKeyField(): bool; |
| 135 | |
| 136 | /** |
| 137 | * Has validator results |
| 138 | * |
| 139 | * @return bool |
| 140 | */ |
| 141 | public function hasResults(): bool; |
| 142 | |
| 143 | /** |
| 144 | * Set the validator name |
| 145 | * |
| 146 | * @param ?string $name |
| 147 | * @return static |
| 148 | */ |
| 149 | public function setName(?string $name = null): static; |
| 150 | |
| 151 | /** |
| 152 | * Set the validator description |
| 153 | * |
| 154 | * @param ?string $description |
| 155 | * @return static |
| 156 | */ |
| 157 | public function setDescription(?string $description = null): static; |
| 158 | |
| 159 | /** |
| 160 | * Set the validator value |
| 161 | * |
| 162 | * @param mixed $value |
| 163 | * @return ValidatorInterface |
| 164 | */ |
| 165 | public function setValue(mixed $value): ValidatorInterface; |
| 166 | |
| 167 | /** |
| 168 | * Set the validator default message |
| 169 | * |
| 170 | * @param ?string $message |
| 171 | * @return ValidatorInterface |
| 172 | */ |
| 173 | public function setMessage(?string $message = null): ValidatorInterface; |
| 174 | |
| 175 | /** |
| 176 | * Set the validator input |
| 177 | * |
| 178 | * @param mixed $input |
| 179 | * @return ValidatorInterface |
| 180 | */ |
| 181 | public function setInput(mixed $input = null): ValidatorInterface; |
| 182 | |
| 183 | /** |
| 184 | * Set the validator field |
| 185 | * |
| 186 | * @param ?string $field |
| 187 | * @return AbstractValidator |
| 188 | */ |
| 189 | public function setField(?string $field = null): ValidatorInterface; |
| 190 | |
| 191 | /** |
| 192 | * Evaluate |
| 193 | * |
| 194 | * @param mixed $input |
| 195 | * @return bool |
| 196 | */ |
| 197 | public function evaluate(mixed $input = null): bool; |
| 198 | |
| 199 | /** |
| 200 | * Generate default message |
| 201 | |
| 202 | * @param mixed $name |
| 203 | * @param mixed $value |
| 204 | * @return string |
| 205 | */ |
| 206 | public function generateDefaultMessage(mixed $name = null, mixed $value = null): string; |
| 207 | |
| 208 | } |