| Total Complexity | 8 |
| Total Lines | 96 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class ValidationUtils |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Checks that $mixed value is an email. |
||
| 13 | * |
||
| 14 | * @param mixed $mixed |
||
| 15 | * |
||
| 16 | * @return bool |
||
| 17 | */ |
||
| 18 | public function isEmail($mixed): bool |
||
| 19 | { |
||
| 20 | return StaticValidationUtils::isEmail($mixed); |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Checks that $mixed value is a hexadecimal value. |
||
| 25 | * |
||
| 26 | * @param mixed $mixed |
||
| 27 | * |
||
| 28 | * @return bool |
||
| 29 | */ |
||
| 30 | public function isHexadecimal($mixed) |
||
| 31 | { |
||
| 32 | return StaticValidationUtils::isHexadecimal($mixed); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Checks that $mixed value is an IP (v4 or v6). |
||
| 37 | * |
||
| 38 | * @param mixed $mixed |
||
| 39 | * |
||
| 40 | * @return bool |
||
| 41 | */ |
||
| 42 | public function isIp($mixed): bool |
||
| 43 | { |
||
| 44 | return StaticValidationUtils::isIp($mixed); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Checks that $mixed value is a decimal number (float or integer). |
||
| 49 | * |
||
| 50 | * @param mixed $mixed |
||
| 51 | * |
||
| 52 | * @return bool |
||
| 53 | */ |
||
| 54 | public function isNumber($mixed): bool |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Checks that $string value is a phone number. |
||
| 61 | * |
||
| 62 | * @param string $string |
||
| 63 | * |
||
| 64 | * @return bool |
||
| 65 | */ |
||
| 66 | public function isPhoneNumber(string $string): bool |
||
| 67 | { |
||
| 68 | return StaticValidationUtils::isPhoneNumber($string); |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Checks that $mixed value is a positive integer (primary key). |
||
| 73 | * |
||
| 74 | * @param mixed $mixed |
||
| 75 | * |
||
| 76 | * @return bool |
||
| 77 | */ |
||
| 78 | public function isPositiveInt($mixed): bool |
||
| 79 | { |
||
| 80 | return StaticValidationUtils::isPositiveInt($mixed); |
||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * Checks that $mixed value is an URL. |
||
| 85 | * |
||
| 86 | * @param mixed $mixed |
||
| 87 | * |
||
| 88 | * @return bool |
||
| 89 | */ |
||
| 90 | public function isURL($mixed): bool |
||
| 91 | { |
||
| 92 | return StaticValidationUtils::isURL($mixed); |
||
| 93 | } |
||
| 94 | |||
| 95 | /** |
||
| 96 | * Checks that $mixed value is magnet URL. |
||
| 97 | * |
||
| 98 | * @param mixed $mixed |
||
| 99 | * |
||
| 100 | * @return bool |
||
| 101 | */ |
||
| 102 | public function isURLMagnet($mixed): bool |
||
| 105 | } |
||
| 106 | } |
||
| 107 |