| Conditions | 9 |
| Paths | 7 |
| Total Lines | 34 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | public function match($pattern, $input) |
||
| 10 | { |
||
| 11 | $result = false; |
||
| 12 | |||
| 13 | if (!is_array($input) && !is_string($input)) { |
||
| 14 | return false; |
||
| 15 | } |
||
| 16 | |||
| 17 | if (!is_array($input)) { |
||
| 18 | return (stripos($input, $pattern) === 0); |
||
| 19 | } |
||
| 20 | |||
| 21 | foreach ($input as $key => $value) { |
||
| 22 | if (is_array($value)) { |
||
| 23 | if (!$result = $this->match($pattern, $value)) { |
||
| 24 | continue; |
||
| 25 | } |
||
| 26 | |||
| 27 | break; |
||
| 28 | } |
||
| 29 | |||
| 30 | if (!$this->isInput($key)) { |
||
| 31 | continue; |
||
| 32 | } |
||
| 33 | |||
| 34 | if (!$result = (stripos($value, $pattern) === 0)) { |
||
| 35 | continue; |
||
| 36 | } |
||
| 37 | |||
| 38 | break; |
||
| 39 | } |
||
| 40 | |||
| 41 | return $result; |
||
| 42 | } |
||
| 43 | } |
||
| 44 |