@@ 8-40 (lines=33) @@ | ||
5 | /** |
|
6 | * Class FooterNode. |
|
7 | */ |
|
8 | class FooterNode extends BaseNode |
|
9 | { |
|
10 | /** |
|
11 | * @param \Twig_Compiler $compiler |
|
12 | */ |
|
13 | public function compile(\Twig_Compiler $compiler) |
|
14 | { |
|
15 | $compiler->addDebugInfo($this) |
|
16 | ->write(self::CODE_FIX_CONTEXT) |
|
17 | ->write('$footerType = ') |
|
18 | ->subcompile($this->getNode('type')) |
|
19 | ->raw(';'.PHP_EOL) |
|
20 | ->write('$footerType = $footerType ? $footerType : \'footer\';'.PHP_EOL) |
|
21 | ->write('$footerProperties = ') |
|
22 | ->subcompile($this->getNode('properties')) |
|
23 | ->raw(';'.PHP_EOL) |
|
24 | ->write(self::CODE_INSTANCE.'->startHeaderFooter($footerType, $footerProperties);'.PHP_EOL) |
|
25 | ->write('unset($footerType, $footerProperties);'.PHP_EOL) |
|
26 | ->subcompile($this->getNode('body')) |
|
27 | ->addDebugInfo($this) |
|
28 | ->write(self::CODE_INSTANCE.'->endHeaderFooter();'.PHP_EOL); |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * @return string[] |
|
33 | */ |
|
34 | public function getAllowedParents(): array |
|
35 | { |
|
36 | return [ |
|
37 | SheetNode::class, |
|
38 | ]; |
|
39 | } |
|
40 | } |
|
41 |
@@ 8-40 (lines=33) @@ | ||
5 | /** |
|
6 | * Class HeaderNode. |
|
7 | */ |
|
8 | class HeaderNode extends BaseNode |
|
9 | { |
|
10 | /** |
|
11 | * @param \Twig_Compiler $compiler |
|
12 | */ |
|
13 | public function compile(\Twig_Compiler $compiler) |
|
14 | { |
|
15 | $compiler->addDebugInfo($this) |
|
16 | ->write(self::CODE_FIX_CONTEXT) |
|
17 | ->write('$headerType = ') |
|
18 | ->subcompile($this->getNode('type')) |
|
19 | ->raw(';'.PHP_EOL) |
|
20 | ->write('$headerType = $headerType ? $headerType : \'header\';'.PHP_EOL) |
|
21 | ->write('$headerProperties = ') |
|
22 | ->subcompile($this->getNode('properties')) |
|
23 | ->raw(';'.PHP_EOL) |
|
24 | ->write(self::CODE_INSTANCE.'->startHeaderFooter($headerType, $headerProperties);'.PHP_EOL) |
|
25 | ->write('unset($headerType, $headerProperties);'.PHP_EOL) |
|
26 | ->subcompile($this->getNode('body')) |
|
27 | ->addDebugInfo($this) |
|
28 | ->write(self::CODE_INSTANCE.'->endHeaderFooter();'.PHP_EOL); |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * @return string[] |
|
33 | */ |
|
34 | public function getAllowedParents(): array |
|
35 | { |
|
36 | return [ |
|
37 | SheetNode::class, |
|
38 | ]; |
|
39 | } |
|
40 | } |
|
41 |
@@ 8-43 (lines=36) @@ | ||
5 | /** |
|
6 | * Class SheetNode. |
|
7 | */ |
|
8 | class SheetNode extends BaseNode |
|
9 | { |
|
10 | /** |
|
11 | * @param \Twig_Compiler $compiler |
|
12 | */ |
|
13 | public function compile(\Twig_Compiler $compiler) |
|
14 | { |
|
15 | $compiler->addDebugInfo($this) |
|
16 | ->write(self::CODE_FIX_CONTEXT) |
|
17 | ->write('$sheetIndex = ') |
|
18 | ->subcompile($this->getNode('index')) |
|
19 | ->raw(';'.PHP_EOL) |
|
20 | ->write('$sheetProperties = ') |
|
21 | ->subcompile($this->getNode('properties')) |
|
22 | ->raw(';'.PHP_EOL) |
|
23 | ->write(self::CODE_INSTANCE.'->startSheet($sheetIndex, $sheetProperties);'.PHP_EOL) |
|
24 | ->write('unset($sheetIndex, $sheetProperties);'.PHP_EOL); |
|
25 | ||
26 | if ($this->hasNode('body')) { |
|
27 | $compiler->subcompile($this->getNode('body')); |
|
28 | } |
|
29 | ||
30 | $compiler->addDebugInfo($this) |
|
31 | ->write(self::CODE_INSTANCE.'->endSheet();'.PHP_EOL); |
|
32 | } |
|
33 | ||
34 | /** |
|
35 | * @return string[] |
|
36 | */ |
|
37 | public function getAllowedParents(): array |
|
38 | { |
|
39 | return [ |
|
40 | DocumentNode::class, |
|
41 | ]; |
|
42 | } |
|
43 | } |
|
44 |