Conditions | 8 |
Paths | 7 |
Total Lines | 28 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 72 |
Changes | 0 |
1 | <?php |
||
38 | public function enterNode(Node $node) |
||
39 | { |
||
40 | if (!$node instanceof Node\Expr\FuncCall || null === $node->name) { |
||
41 | return $node; |
||
42 | } |
||
43 | |||
44 | if (!$node->name instanceof Node\Name) { |
||
45 | return $node; |
||
46 | } |
||
47 | |||
48 | if (!in_array($node->name->getFirst(), $this->functions)) { |
||
49 | return $node; |
||
50 | } |
||
51 | |||
52 | $value = $node->args[0]->value; |
||
53 | if (!$value instanceof Node\Scalar\String_) { |
||
54 | return $node; |
||
55 | } |
||
56 | |||
57 | $stringValue = ltrim($value->value, '\\'); |
||
58 | |||
59 | // Do not prefix global namespace |
||
60 | if (false !== strstr($stringValue, '\\')) { |
||
61 | $value->value = ($value->value !== $stringValue ? '\\' : '').$this->prefix.'\\'.$stringValue; |
||
62 | } |
||
63 | |||
64 | return $node; |
||
65 | } |
||
66 | } |
||
67 |