1 | <?php |
||
2 | |||
3 | namespace Dtc\GridBundle\Twig\Extension; |
||
4 | |||
5 | class TwigExtension extends \Twig\Extension\AbstractExtension |
||
0 ignored issues
–
show
|
|||
6 | { |
||
7 | public function getFunction() |
||
8 | { |
||
9 | $names = [ |
||
10 | 'format_cell' => 'format_cell', |
||
11 | ]; |
||
12 | |||
13 | $funcs = []; |
||
14 | foreach ($names as $twig => $local) { |
||
15 | $funcs[$twig] = new \Twig\TwigFunction($twig, [$this, $local]); |
||
0 ignored issues
–
show
The type
Twig\TwigFunction was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
16 | } |
||
17 | |||
18 | return $funcs; |
||
19 | } |
||
20 | |||
21 | public function getFilters() |
||
22 | { |
||
23 | $names = [ |
||
24 | 'format_cell' => 'format_cell', |
||
25 | ]; |
||
26 | |||
27 | $funcs = []; |
||
28 | foreach ($names as $twig => $local) { |
||
29 | $funcs[$twig] = new \Twig\TwigFilter($twig, [$this, $local]); |
||
0 ignored issues
–
show
The type
Twig\TwigFilter was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
30 | } |
||
31 | |||
32 | return $funcs; |
||
33 | } |
||
34 | |||
35 | public function getName() |
||
36 | { |
||
37 | return 'dtc_grid'; |
||
38 | } |
||
39 | |||
40 | public function format_cell($value) |
||
41 | { |
||
42 | if (is_object($value)) { |
||
43 | if ($value instanceof \DateTime) { |
||
44 | return $value->format(\DateTime::ISO8601); |
||
45 | } |
||
46 | |||
47 | return 'object: '.get_class($value); |
||
48 | } elseif (is_scalar($value)) { |
||
49 | return $value; |
||
50 | } elseif (is_array($value)) { |
||
51 | return 'array'; |
||
52 | } |
||
53 | } |
||
54 | } |
||
55 |
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