| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 49 | protected function doEnterNode(\Twig_Node $node, \Twig_Environment $env) |
|
| 24 | { |
||
| 25 | // add wrapper instance as argument on all method calls |
||
| 26 | 49 | if ($node instanceof \Twig_Node_Expression_MethodCall) { |
|
| 27 | 1 | $keyNode = new \Twig_Node_Expression_Constant(PhpSpreadsheetWrapper::INSTANCE_KEY, $node->getTemplateLine()); |
|
| 28 | |||
| 29 | // add wrapper even if it not exists, we fix that later |
||
| 30 | 1 | $valueNode = new \Twig_Node_Expression_Name(PhpSpreadsheetWrapper::INSTANCE_KEY, $node->getTemplateLine()); |
|
| 31 | 1 | $valueNode->setAttribute('ignore_strict_check', true); |
|
| 32 | |||
| 33 | /** |
||
| 34 | * @var \Twig_Node_Expression_Array $argumentsNode |
||
| 35 | */ |
||
| 36 | 1 | $argumentsNode = $node->getNode('arguments'); |
|
| 37 | 1 | $argumentsNode->addElement($valueNode, $keyNode); |
|
| 38 | } |
||
| 39 | |||
| 40 | 49 | return $node; |
|
| 41 | } |
||
| 42 | |||
| 51 |