Conditions | 6 |
Paths | 8 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
44 | 5 | public function check($item, $whitelist = null) |
|
45 | { |
||
46 | 5 | if ($whitelist !== null) { |
|
47 | 2 | $this->set($whitelist); |
|
48 | 2 | } |
|
49 | |||
50 | 5 | if (empty($item) or empty($this->whitelist)) { |
|
51 | 1 | return false; |
|
52 | } |
||
53 | |||
54 | 4 | foreach ($this->whitelist as $regexp) { |
|
55 | 4 | if (preg_match("#$regexp#", $item)) { |
|
56 | 2 | return true; |
|
57 | } |
||
58 | 2 | } |
|
59 | |||
60 | 2 | return false; |
|
61 | } |
||
62 | } |
||
63 |