mmucklo /
DtcGridBundle
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Dtc\GridBundle\Twig\Extension; |
||
| 4 | |||
| 5 | use Twig\Extension\AbstractExtension; |
||
|
0 ignored issues
–
show
|
|||
| 6 | use Twig\TwigFilter; |
||
|
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 Loading history...
|
|||
| 7 | use Twig\TwigFunction; |
||
|
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 Loading history...
|
|||
| 8 | |||
| 9 | class TwigExtension extends AbstractExtension |
||
| 10 | { |
||
| 11 | public function getFunction() |
||
| 12 | { |
||
| 13 | $names = array( |
||
| 14 | 'format_cell' => 'format_cell', |
||
| 15 | ); |
||
| 16 | |||
| 17 | $funcs = array(); |
||
| 18 | foreach ($names as $twig => $local) { |
||
| 19 | $funcs[$twig] = new TwigFunction($twig, [$this, $local]); |
||
| 20 | } |
||
| 21 | |||
| 22 | return $funcs; |
||
| 23 | } |
||
| 24 | |||
| 25 | public function getFilters() |
||
| 26 | { |
||
| 27 | $names = array( |
||
| 28 | 'format_cell' => 'format_cell', |
||
| 29 | ); |
||
| 30 | |||
| 31 | $funcs = array(); |
||
| 32 | foreach ($names as $twig => $local) { |
||
| 33 | $funcs[$twig] = new TwigFilter($twig, [$this, $local]); |
||
| 34 | } |
||
| 35 | |||
| 36 | return $funcs; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function getName() |
||
| 40 | { |
||
| 41 | return 'dtc_grid'; |
||
| 42 | } |
||
| 43 | |||
| 44 | public function format_cell($value) |
||
| 45 | { |
||
| 46 | if (is_object($value)) { |
||
| 47 | if ($value instanceof \DateTime) { |
||
| 48 | return $value->format(\DateTime::ISO8601); |
||
| 49 | } |
||
| 50 | |||
| 51 | return 'object: '.get_class($value); |
||
| 52 | } elseif (is_scalar($value)) { |
||
| 53 | return $value; |
||
| 54 | } elseif (is_array($value)) { |
||
| 55 | return 'array'; |
||
| 56 | } |
||
| 57 | } |
||
| 58 | } |
||
| 59 |
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