| Conditions | 9 |
| Paths | 6 |
| Total Lines | 27 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | protected function doEnterNode(Twig_Node $node, Twig_Environment $env) |
||
| 32 | { |
||
| 33 | if (($node instanceof Twig_Node_Block || $node instanceof Twig_Node_Macro) && !$node->hasAttribute('twigExcelBundle') && NodeHelper::checkContainsXlsNode($node)) { |
||
| 34 | if ($node instanceof Twig_Node_Block) { |
||
| 35 | throw new Twig_Error_Syntax('Block tags do not work together with Twig tags provided by TwigExcelBundle. Please use \'xlsblock\' instead.'); |
||
| 36 | } |
||
| 37 | elseif ($node instanceof Twig_Node_Macro) { |
||
| 38 | throw new Twig_Error_Syntax('Macro tags do not work together with Twig tags provided by TwigExcelBundle. Please use \'xlsmacro\' instead.'); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | elseif ($node instanceof SyntaxAwareNodeInterface) { |
||
| 42 | /** |
||
| 43 | * @var SyntaxAwareNodeInterface $node |
||
| 44 | */ |
||
| 45 | try { |
||
| 46 | NodeHelper::checkAllowedParents($node, $this->path); |
||
| 47 | } catch(Twig_Error_Syntax $e) { |
||
| 48 | // reset path since throwing an error prevents doLeaveNode to be called |
||
| 49 | $this->path = []; |
||
| 50 | throw $e; |
||
| 51 | } |
||
| 52 | } |
||
| 53 | |||
| 54 | $this->path[] = get_class($node); |
||
| 55 | |||
| 56 | return $node; |
||
| 57 | } |
||
| 58 | |||
| 77 |