These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Amarkal\Validation; |
||
4 | |||
5 | class Strings |
||
6 | { |
||
7 | static function length_less_than( $str, $length ) |
||
0 ignored issues
–
show
|
|||
8 | { |
||
9 | return strlen($str) < $length; |
||
10 | } |
||
11 | |||
12 | static function length_greater_than( $str, $length ) |
||
0 ignored issues
–
show
|
|||
13 | { |
||
14 | return strlen($str) > $length; |
||
15 | } |
||
16 | |||
17 | static function match( $str, $regex ) |
||
0 ignored issues
–
show
|
|||
18 | { |
||
19 | return preg_match($regex, $str) === 1; |
||
20 | } |
||
21 | |||
22 | static function is_email( $str ) |
||
0 ignored issues
–
show
|
|||
23 | { |
||
24 | return \is_email( $str ) !== false; |
||
25 | } |
||
26 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.