1 | <?php |
||
2 | |||
3 | namespace Dtc\GridBundle\Grid\Column; |
||
4 | |||
5 | use Dtc\GridBundle\Grid\Source\GridSourceInterface; |
||
6 | use Twig_Template; |
||
0 ignored issues
–
show
|
|||
7 | |||
8 | class TwigBlockGridColumn extends AbstractGridColumn |
||
9 | { |
||
10 | protected $template; |
||
11 | protected $blockName; |
||
12 | protected $env = []; |
||
13 | |||
14 | /** |
||
15 | * Block name. |
||
16 | * |
||
17 | * @param string $field |
||
18 | * @param string $label |
||
19 | * @param string $blockName |
||
20 | */ |
||
21 | public function __construct($field, $label, Twig_Template $template, array $env, $blockName = null) |
||
22 | { |
||
23 | $this->field = $field; |
||
24 | $this->label = $label; |
||
25 | $this->template = $template; |
||
26 | $this->blockName = $blockName; |
||
27 | $this->env = $env; |
||
28 | |||
29 | if (!$this->blockName) { |
||
30 | $this->blockName = $field; |
||
31 | } |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @return $template |
||
0 ignored issues
–
show
|
|||
36 | */ |
||
37 | public function getTemplate() |
||
38 | { |
||
39 | return $this->template; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return $blockName |
||
0 ignored issues
–
show
|
|||
44 | */ |
||
45 | public function getBlockName() |
||
46 | { |
||
47 | return $this->blockName; |
||
48 | } |
||
49 | |||
50 | public function format($object, GridSourceInterface $gridSource) |
||
51 | { |
||
52 | if ($this->template->hasBlock($this->blockName, [])) { |
||
53 | $this->env['obj'] = $object; |
||
54 | $this->env['source'] = $gridSource; |
||
55 | |||
56 | return $this->template->renderBlock($this->blockName, $this->env); |
||
57 | } else { |
||
58 | return 'No Template'; |
||
59 | } |
||
60 | } |
||
61 | } |
||
62 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths