Conditions | 7 |
Paths | 16 |
Total Lines | 30 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
24 | public function compile(Buffer $buffer) |
||
25 | { |
||
26 | /** @var Script\Annotation[] $annotations */ |
||
27 | $annotations = array(); |
||
28 | $nodes = $this->nodes; |
||
29 | while (current($nodes) instanceof Script\Annotation) { |
||
30 | $annotations[] = array_shift($nodes); |
||
31 | } |
||
32 | |||
33 | foreach ($annotations as $annotation) { |
||
34 | $annotation->beforeScript($buffer); |
||
35 | } |
||
36 | |||
37 | if (count($this->nodes)) { |
||
38 | $buffer->write('$z->cmd('); |
||
39 | foreach ($nodes as $i => $node) { |
||
40 | if ($i > 0) { |
||
41 | $buffer->raw(' . '); |
||
42 | } |
||
43 | $buffer->raw('$z->str('); |
||
44 | $node->compile($buffer); |
||
45 | $buffer->raw(')'); |
||
46 | } |
||
47 | $buffer->raw(');')->eol(); |
||
48 | } |
||
49 | |||
50 | foreach (array_reverse($annotations) as $annotation) { |
||
51 | $annotation->afterScript($buffer); |
||
52 | } |
||
53 | } |
||
54 | } |
||
55 |