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 | /** |
| 3 | * Jingga |
| 4 | * |
| 5 | * PHP Version 8.1 |
| 6 | * |
| 7 | * @package phpOMS\Validation |
| 8 | * @copyright Dennis Eichhorn |
| 9 | * @license OMS License 2.0 |
| 10 | * @version 1.0.0 |
| 11 | * @link https://jingga.app |
| 12 | */ |
| 13 | declare(strict_types=1); |
| 14 | |
| 15 | namespace phpOMS\Validation; |
| 16 | |
| 17 | /** |
| 18 | * Validator interface. |
| 19 | * |
| 20 | * @package phpOMS\Validation |
| 21 | * @license OMS License 2.0 |
| 22 | * @link https://jingga.app |
| 23 | * @since 1.0.0 |
| 24 | */ |
| 25 | interface ValidatorInterface |
| 26 | { |
| 27 | /** |
| 28 | * Check if value is valid. |
| 29 | * |
| 30 | * @param mixed $value Value to validate |
| 31 | * @param null|array $constraints Constraints for validation |
| 32 | * |
| 33 | * @return bool |
| 34 | * |
| 35 | * @since 1.0.0 |
| 36 | */ |
| 37 | public static function isValid(mixed $value, array $constraints = null) : bool; |
| 38 | |
| 39 | /** |
| 40 | * Get most recent error string. |
| 41 | * |
| 42 | * @return string |
| 43 | * |
| 44 | * @since 1.0.0 |
| 45 | */ |
| 46 | public static function getMessage() : string; |
| 47 | |
| 48 | /** |
| 49 | * Get most recent error code. |
| 50 | * |
| 51 | * @return int |
| 52 | * |
| 53 | * @since 1.0.0 |
| 54 | */ |
| 55 | public static function getErrorCode() : int; |
| 56 | |
| 57 | /** |
| 58 | * Reset error information |
| 59 | * |
| 60 | * @return void |
| 61 | * |
| 62 | * @since 1.0.0 |
| 63 | */ |
| 64 | public static function resetError() : void; |
| 65 | } |