| Total Complexity | 12 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class Validate |
||
| 14 | { |
||
| 15 | 8 | public static function string($string, array $options = []) |
|
| 16 | { |
||
| 17 | 8 | $options = array_merge([ |
|
| 18 | 8 | 'minlength' => 1, |
|
| 19 | 8 | 'maxlength' => false, |
|
| 20 | 8 | ], $options); |
|
| 21 | |||
| 22 | 8 | return !empty($string) && is_string($string) |
|
| 23 | 8 | && (strlen($string) >= $options['minlength']) |
|
| 24 | 8 | && (($options['maxlength'] == false) || (strlen($string) <= $options['maxlength'])); |
|
| 25 | } |
||
| 26 | |||
| 27 | 6 | public static function number($number, array $options = []) |
|
| 37 | } |
||
| 38 | |||
| 39 | 3 | public static function email($email, array $options = []) |
|
| 45 | } |
||
| 46 | } |
||
| 48 |