| 1 | <?php |
||
| 22 | class IntegerHelper { |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Determines if a value is an integer. |
||
| 26 | * |
||
| 27 | * @param mixed $value The value. |
||
| 28 | * @return void |
||
| 29 | * @throws IntegerArgumentException Throws a Integer argument exception if the value is not of expected type. |
||
| 30 | */ |
||
| 31 | public static function isInteger($value): void { |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Parse a boolean. |
||
| 39 | * |
||
| 40 | * @param bool|null $value The boolean value. |
||
| 41 | * @return int Returns 1 in case of success, 0 otherwise. |
||
| 42 | */ |
||
| 43 | public static function parseBoolean(?bool $value): int { |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Parse a string. |
||
| 49 | * |
||
| 50 | * @param string|null $value The string value. |
||
| 51 | * @return int|null Returns the integer in case of success, null otherwise. |
||
| 52 | * @throws IntegerArgumentException Throws an integer argument exception if the string value does not represent an integer. |
||
| 53 | */ |
||
| 54 | public static function parseString(?string $value): ?int { |
||
| 63 | } |
||
| 64 |