Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
29 | 5 | public function isValid($value) |
|
30 | { |
||
31 | 5 | $this->value = $this->standardValue = $value; |
|
32 | |||
33 | 5 | $this->checkMissingOptions(); |
|
34 | |||
35 | 4 | if (!is_string($value)) { |
|
36 | 2 | $this->setError(self::NOT_STRING); |
|
37 | 2 | return false; |
|
38 | } |
||
39 | |||
40 | 3 | if (!preg_match($this->options['regex'], $value)) { |
|
41 | 2 | $this->setError($this->notMatchCode); |
|
42 | 2 | return false; |
|
43 | } |
||
44 | |||
45 | 1 | return true; |
|
46 | } |
||
47 | } |
||
48 |