Total Complexity | 8 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
7 | class StringUtils |
||
8 | { |
||
9 | /** |
||
10 | * @param string $string |
||
11 | * @param string $errorMessage |
||
12 | * |
||
13 | * @throws \InvalidArgumentException |
||
14 | */ |
||
15 | 26 | public static function assertNotEmpty(string $string, string $errorMessage = 'Empty string provided'): void |
|
19 | } |
||
20 | 24 | } |
|
21 | |||
22 | /** |
||
23 | * @param null|string $string |
||
24 | * @param string $errorMessage |
||
25 | * |
||
26 | * @throws \InvalidArgumentException |
||
27 | */ |
||
28 | 8 | public static function assertNumericOrNull(?string $string, string $errorMessage = 'Parameter is not numeric'): void |
|
29 | { |
||
30 | 8 | if (null !== $string && !is_numeric($string)) { |
|
31 | 2 | throw new \InvalidArgumentException($errorMessage); |
|
32 | } |
||
33 | 7 | } |
|
34 | |||
35 | /** |
||
36 | * @param string $errorMessage |
||
37 | * @param null[]|string[] ...$arguments |
||
38 | * |
||
39 | * @throws \InvalidArgumentException |
||
40 | */ |
||
41 | 6 | public static function assertAtLeastOneArgumentNotNull(string $errorMessage, ?string ...$arguments): void |
|
50 | } |
||
51 | } |
||
52 |