| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 10 | public function validate($input): bool |
|
| 28 | { |
||
| 29 | 10 | if (is_array($this->haystack)) { |
|
| 30 | 5 | return in_array($input, $this->haystack, true); |
|
| 31 | } |
||
| 32 | |||
| 33 | 5 | if (!is_string($this->haystack)) { |
|
| 34 | 1 | return false; |
|
| 35 | } |
||
| 36 | |||
| 37 | 4 | if (empty($input)) { |
|
| 38 | 1 | return false; |
|
| 39 | } |
||
| 40 | |||
| 41 | 3 | $enc = mb_detect_encoding($input); |
|
| 42 | |||
| 43 | 3 | return mb_strpos($this->haystack, $input, 0, $enc) !== false; |
|
| 44 | } |
||
| 45 | } |
||
| 46 |