Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
11 / 11 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
Validate | |
100.00% |
11 / 11 |
|
100.00% |
5 / 5 |
8 | |
100.00% |
1 / 1 |
float | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
int | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
integerID | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
text | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
query | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Projom\Util; |
6 | |
7 | use Projom\Util\Regex; |
8 | |
9 | class Validate |
10 | { |
11 | public static function float(int|float|string $float): bool |
12 | { |
13 | return Regex::matchFloat($float); |
14 | } |
15 | |
16 | public static function int(int|float|string $int): bool |
17 | { |
18 | return Regex::matchInteger($int); |
19 | } |
20 | |
21 | public static function integerID(int|float|string $id): bool |
22 | { |
23 | if ($id <= 0) |
24 | return false; |
25 | |
26 | return Regex::matchIntegerID($id); |
27 | } |
28 | |
29 | public static function text(string $string): bool |
30 | { |
31 | if ($string === '') |
32 | return true; |
33 | |
34 | return Regex::matchText($string); |
35 | } |
36 | |
37 | public static function query(string $query): bool |
38 | { |
39 | if ($query === '') |
40 | return false; |
41 | |
42 | return Regex::matchQuery($query); |
43 | } |
44 | } |