| Conditions | 9 |
| Paths | 10 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function applyToNode(Node $node) |
||
| 21 | { |
||
| 22 | $instruction = $node->getInstruction($this); |
||
| 23 | |||
| 24 | if (is_array($instruction) || is_object($instruction)) { |
||
| 25 | $instruction = (object)$instruction; |
||
| 26 | } |
||
| 27 | |||
| 28 | if (!isset($instruction) || !isset($instruction->input)) { |
||
| 29 | return; |
||
| 30 | } |
||
| 31 | |||
| 32 | if (!isset($instruction->find) && !isset($instruction->regex)) { |
||
| 33 | return; |
||
| 34 | } |
||
| 35 | |||
| 36 | if (isset($instruction->find)) { |
||
| 37 | $result = strpos($instruction->input, $instruction->find) !== false; |
||
| 38 | } else { |
||
| 39 | $flags = isset($instruction->flags) ? $instruction->flags : 0; |
||
| 40 | $result = preg_match($instruction->regex, $instruction->input, $matches, $flags); |
||
| 41 | } |
||
| 42 | |||
| 43 | $node->setResult($result); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |