Conditions | 3 |
Paths | 1 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
32 | public function getFunctions() |
||
33 | { |
||
34 | return [ |
||
35 | 248 | new TwigFunction('eccube_block_*', function ($name, array $parameters = []) { |
|
36 | 47 | $sources = $this->blockTemplates; |
|
37 | 47 | foreach ($sources as $source) { |
|
38 | 2 | $template = $this->twig->loadTemplate($source); |
|
39 | 2 | if ($template->hasBlock($name, $parameters)) { |
|
40 | 2 | echo $template->renderBlock($name, $parameters); |
|
41 | |||
42 | 2 | return; |
|
43 | } |
||
44 | } |
||
45 | 45 | @trigger_error($name.' block is not found', E_USER_WARNING); |
|
|
|||
46 | 248 | }, ['pre_escape' => 'html', 'is_safe' => ['html']]), |
|
47 | ]; |
||
48 | } |
||
49 | } |
||
50 |
If you suppress an error, we recommend checking for the error condition explicitly: