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) LOCKON CO.,LTD. All Rights Reserved. |
||
7 | * |
||
8 | * http://www.lockon.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; |
||
15 | |||
16 | use Eccube\Event\TemplateEvent; |
||
17 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
||
18 | |||
19 | class Environment extends \Twig_Environment |
||
0 ignored issues
–
show
|
|||
20 | { |
||
21 | /** |
||
22 | * @var \Twig_Environment |
||
23 | */ |
||
24 | protected $twig; |
||
25 | |||
26 | /** |
||
27 | * @var EventDispatcherInterface |
||
28 | */ |
||
29 | protected $eventDispatcher; |
||
30 | |||
31 | 470 | public function __construct(\Twig_Environment $twig, EventDispatcherInterface $eventDispatcher) |
|
32 | { |
||
33 | 470 | $this->twig = $twig; |
|
34 | 470 | $this->eventDispatcher = $eventDispatcher; |
|
35 | } |
||
36 | |||
37 | 276 | public function render($name, array $context = []) |
|
38 | { |
||
39 | // twigファイルのソースコードを読み込み文字列化する. |
||
40 | 276 | $source = $this->twig->getLoader() |
|
41 | 276 | ->getSourceContext($name) |
|
42 | 276 | ->getCode(); |
|
43 | |||
44 | // プラグインにはテンプレートファイル名, 文字列化されたtwigファイル, パラメータを渡す. |
||
45 | 276 | $event = new TemplateEvent($name, $source, $context); |
|
46 | |||
47 | // テンプレートフックポイントの実行. |
||
48 | 276 | $this->eventDispatcher->dispatch($name, $event); |
|
49 | |||
50 | // プラグインで変更された文字列から, テンプレートオブジェクトを生成. |
||
51 | 276 | $template = $this->twig->createTemplate($event->getSource()); |
|
52 | |||
53 | // レンダリング実行. |
||
54 | 276 | $content = $template->render($event->getParameters()); |
|
55 | |||
56 | 276 | return $content; |
|
57 | } |
||
58 | } |
||
59 |
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.