GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( dea5e9...4057a0 )
by Mewes
02:21
created

DocumentNode::getAllowedParents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace MewesK\TwigSpreadsheetBundle\Twig\Node;
4
5
use MewesK\TwigSpreadsheetBundle\Wrapper\PhpSpreadsheetWrapper;
6
7
/**
8
 * Class DocumentNode.
9
 */
10
class DocumentNode extends BaseNode
11
{
12
    /**
13
     * @var bool
14
     */
15
    private $preCalculateFormulas;
16
    /**
17
     * @var null|string
18
     */
19
    private $diskCachingDirectory;
20
21
    /**
22
     * DocumentNode constructor.
23
     *
24
     * @param array       $nodes
25
     * @param array       $attributes
26
     * @param int         $lineno
27
     * @param string|null $tag
28
     */
29
    public function __construct(array $nodes = [], array $attributes = [], int $lineno = 0, string $tag = null)
30
    {
31
        $this->preCalculateFormulas = $attributes['preCalculateFormulas'] ?? false;
32
        $this->diskCachingDirectory = $attributes['diskCachingDirectory'] ?? null;
33
34
        unset($attributes['preCalculateFormulas'], $attributes['diskCachingDirectory']);
35
36
        parent::__construct($nodes, $attributes, $lineno, $tag);
37
    }
38
39
    /**
40
     * @param \Twig_Compiler $compiler
41
     */
42
    public function compile(\Twig_Compiler $compiler)
43
    {
44
        $compiler->addDebugInfo($this)
45
            ->write("ob_start();\n")
46
            ->write('$documentProperties = ')
47
            ->subcompile($this->getNode('properties'))
48
            ->raw(';'.PHP_EOL)
49
            ->write(self::CODE_INSTANCE.' = new '.PhpSpreadsheetWrapper::class.'($context, $this->env);'.PHP_EOL)
50
            ->write(self::CODE_INSTANCE.'->startDocument($documentProperties);'.PHP_EOL)
51
            ->write('unset($documentProperties);'.PHP_EOL)
52
            ->subcompile($this->getNode('body'))
53
            ->addDebugInfo($this)
54
            ->write("ob_end_clean();\n")
55
            ->write(self::CODE_INSTANCE.'->endDocument('.
56
                ($this->preCalculateFormulas ? 'true' : 'false').', '.
57
                ($this->diskCachingDirectory ? '\''.$this->diskCachingDirectory.'\'' : 'null').');'.PHP_EOL)
58
            ->write('unset('.self::CODE_INSTANCE.');'.PHP_EOL);
59
    }
60
61
    /**
62
     * @return string[]
63
     */
64
    public function getAllowedParents(): array
65
    {
66
        return [];
67
    }
68
}
69