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 ( b5b947...dea5e9 )
by Mewes
12:02
created

XlsDocumentNode::canContainText()   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 XlsDocumentNode
9
 *
10
 * @package MewesK\TwigSpreadsheetBundle\Twig\Node
11
 */
12
class XlsDocumentNode extends SyntaxAwareNode
13
{
14
    /**
15
     * @var bool
16
     */
17
    private $preCalculateFormulas;
18
    /**
19
     * @var null|string
20
     */
21
    private $diskCachingDirectory;
22
23
    /**
24
     * @param \Twig_Node_Expression $properties
25
     * @param \Twig_Node $body
26
     * @param int $line
27
     * @param string $tag
28
     * @param bool $preCalculateFormulas
29
     * @param null|string $diskCachingDirectory
30
     */
31
    public function __construct(\Twig_Node_Expression $properties, \Twig_Node $body, $line = 0, $tag = 'xlsdocument', $preCalculateFormulas = true, $diskCachingDirectory = null)
32
    {
33
        parent::__construct(['properties' => $properties, 'body' => $body], [], $line, $tag);
34
        $this->preCalculateFormulas = $preCalculateFormulas;
35
        $this->diskCachingDirectory = $diskCachingDirectory;
36
    }
37
38
    /**
39
     * @param \Twig_Compiler $compiler
40
     */
41
    public function compile(\Twig_Compiler $compiler)
42
    {
43
        $compiler->addDebugInfo($this)
44
            ->write("ob_start();\n")
45
            ->write('$documentProperties = ')
46
            ->subcompile($this->getNode('properties'))
47
            ->raw(';' . PHP_EOL)
48
            ->write('$context[\'' . PhpSpreadsheetWrapper::INSTANCE_KEY . '\'] = new ' . PhpSpreadsheetWrapper::class . '($context, $this->env);' . PHP_EOL)
49
            ->write('$context[\'' . PhpSpreadsheetWrapper::INSTANCE_KEY . '\']->startDocument($documentProperties);' . PHP_EOL)
50
            ->write('unset($documentProperties);' . PHP_EOL)
51
            ->subcompile($this->getNode('body'))
52
            ->addDebugInfo($this)
53
            ->write("ob_end_clean();\n")
54
            ->write('$context[\'' . PhpSpreadsheetWrapper::INSTANCE_KEY . '\']->endDocument(' .
55
                ($this->preCalculateFormulas ? 'true' : 'false') . ', ' .
56
                ($this->diskCachingDirectory ? '\'' . $this->diskCachingDirectory . '\'' : 'null') . ');' . PHP_EOL)
57
            ->write('unset($context[\'' . PhpSpreadsheetWrapper::INSTANCE_KEY . '\']);' . PHP_EOL);
58
    }
59
60
    /**
61
     * @return string[]
62
     */
63
    public function getAllowedParents(): array
64
    {
65
        return [];
66
    }
67
}
68