| Conditions | 3 |
| Paths | 4 |
| Total Lines | 27 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 20 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 26 | 3 | public function compile(Twig_Compiler $compiler) |
|
| 27 | { |
||
| 28 | 3 | if ($this->getAttribute('as_string')) { |
|
| 29 | 1 | $compiler->raw('(string) '); |
|
| 30 | 1 | } |
|
| 31 | |||
| 32 | 3 | if ($this->getAttribute('output')) { |
|
| 33 | $compiler |
||
| 34 | 1 | ->addDebugInfo($this) |
|
| 35 | 1 | ->write("\$_defer_block_references = \$this->env->getExtension('defer')->retrieve(") |
|
| 36 | 1 | ->subcompile($this->getNode('name')) |
|
| 37 | 1 | ->raw(");\n") |
|
| 38 | 1 | ->write("foreach (\$_defer_block_references as \$_defer_block_reference) {\n") |
|
| 39 | 1 | ->indent() |
|
| 40 | 1 | ->write("echo \$_defer_block_reference;\n") |
|
| 41 | 1 | ->outdent() |
|
| 42 | 1 | ->write("}\n") |
|
| 43 | 1 | ->write("unset(\$_defer_block_references,\$_defer_block_reference);\n") |
|
| 44 | ; |
||
| 45 | 1 | } else { |
|
| 46 | $compiler |
||
| 47 | 2 | ->raw("implode('', \$this->env->getExtension('defer')->retrieve(") |
|
| 48 | 2 | ->subcompile($this->getNode('name')) |
|
| 49 | 2 | ->raw("))\n") |
|
| 50 | ; |
||
| 51 | } |
||
| 52 | 3 | } |
|
| 53 | } |
||
| 54 |