| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | 11 | public function validate($input): bool |
|
| 43 | { |
||
| 44 | 11 | if (is_array($this->haystack)) { |
|
| 45 | 5 | return in_array($input, $this->haystack, false); |
|
| 46 | } |
||
| 47 | |||
| 48 | 6 | if (!is_string($this->haystack)) { |
|
| 49 | 1 | return false; |
|
| 50 | } |
||
| 51 | |||
| 52 | 5 | if (empty($input)) { |
|
| 53 | 1 | return false; |
|
| 54 | } |
||
| 55 | |||
| 56 | 4 | $enc = mb_detect_encoding($input); |
|
| 57 | |||
| 58 | 4 | return mb_stripos($this->haystack, $input, 0, $enc) !== false; |
|
| 59 | } |
||
| 60 | |||
| 76 |