Completed
Push — master ( 35a26b...9978ce )
by Grégoire
14s
created

src/Twig/Node/PathNode.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\MediaBundle\Twig\Node;
15
16
class PathNode extends \Twig_Node
0 ignored issues
show
Deprecated Code introduced by
The class Twig_Node has been deprecated with message: since Twig 2.7, use "Twig\Node\Node" instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
17
{
18
    /**
19
     * @var string
20
     */
21
    protected $extensionName;
22
23
    /**
24
     * @param string $extensionName
25
     * @param int    $lineno
26
     * @param string $tag
27
     */
28
    public function __construct($extensionName, \Twig_Node_Expression $media, \Twig_Node_Expression $format, $lineno, $tag = null)
29
    {
30
        $this->extensionName = $extensionName;
31
32
        parent::__construct(['media' => $media, 'format' => $format], [], $lineno, $tag);
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function compile(\Twig_Compiler $compiler): void
39
    {
40
        $compiler
41
            ->addDebugInfo($this)
42
            ->write(sprintf("echo \$this->env->getExtension('%s')->path(", $this->extensionName))
43
            ->subcompile($this->getNode('media'))
44
            ->raw(', ')
45
            ->subcompile($this->getNode('format'))
46
            ->raw(");\n")
47
        ;
48
    }
49
}
50