Passed
Push — master ( 1316c5...63993c )
by Matthew
05:18
created

Twig/Extension/TwigExtensionLegacy.php (3 issues)

Labels
Severity
1
<?php
2
3
namespace Dtc\GridBundle\Twig\Extension;
4
5
if (!class_exists('Twig\Extension\AbstractExtension')) {
6
    class TwigExtension extends \Twig_Extension
0 ignored issues
show
The type Twig_Extension 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
    {
8
        public function getFunction()
9
        {
10
            $names = array(
11
                'format_cell' => 'format_cell',
12
            );
13
14
            $funcs = array();
15
            foreach ($names as $twig => $local) {
16
                $funcs[$twig] = new \Twig_SimpleFunction($twig, [$this, $local]);
0 ignored issues
show
The type Twig_SimpleFunction 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
            }
18
19
            return $funcs;
20
        }
21
22
        public function getFilters()
23
        {
24
            $names = array(
25
                'format_cell' => 'format_cell',
26
            );
27
28
            $funcs = array();
29
            foreach ($names as $twig => $local) {
30
                $funcs[$twig] = new \Twig_SimpleFilter($twig, [$this, $local]);
0 ignored issues
show
The type Twig_SimpleFilter 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
31
            }
32
33
            return $funcs;
34
        }
35
36
        public function getName()
37
        {
38
            return 'dtc_grid';
39
        }
40
41
        public function format_cell($value)
42
        {
43
            if (is_object($value)) {
44
                if ($value instanceof \DateTime) {
45
                    return $value->format(\DateTime::ISO8601);
46
                }
47
48
                return 'object: ' . get_class($value);
49
            } elseif (is_scalar($value)) {
50
                return $value;
51
            } elseif (is_array($value)) {
52
                return 'array';
53
            }
54
        }
55
    }
56
}