Completed
Push — 4.0 ( 87d096...bcc1be )
by Kiyotaka
05:44 queued 11s
created

src/Eccube/Twig/Extension/TwigIncludeExtension.php (1 issue)

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
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.ec-cube.co.jp/
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 Eccube\Twig\Extension;
15
16
use Twig\Extension\AbstractExtension;
17
18
class TwigIncludeExtension extends AbstractExtension
19
{
20
    protected $twig;
21
22 470
    public function __construct(\Eccube\Twig\Environment $twig)
23
    {
24 470
        $this->twig = $twig;
25
    }
26
27 241
    public function getFunctions()
28
    {
29
        return [
30 241
            new \Twig_Function('include_dispatch', [$this, 'include_dispatch'],
0 ignored issues
show
Deprecated Code introduced by
The class Twig_Function has been deprecated with message: since Twig 2.7, use "Twig\TwigFunction" 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...
31 241
                ['needs_context' => true, 'is_safe' => ['all']]),
32
        ];
33
    }
34
35 113
    public function include_dispatch($context, $template, $variables = [])
36
    {
37 113
        if (!empty($variables)) {
38
            $context = array_merge($context, $variables);
39
        }
40
41 113
        return $this->twig->render($template, $context);
42
    }
43
}
44