Completed
Push — master ( a9b611...61b36b )
by Matthew
05:54 queued 04:26
created

TwigExtensionLegacy::getFilters()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 12
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Dtc\GridBundle\Twig\Extension;
4
5
class TwigExtensionLegacy extends \Twig_Extension
0 ignored issues
show
Bug introduced by
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...
6
{
7
    public function getFunction()
8
    {
9
        $names = array(
10
            'format_cell' => 'format_cell',
11
        );
12
13
        $funcs = array();
14
        foreach ($names as $twig => $local) {
15
            $funcs[$twig] = new \Twig_SimpleFunction($twig, [$this, $local]);
0 ignored issues
show
Bug introduced by
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...
16
        }
17
18
        return $funcs;
19
    }
20
21
    public function getFilters()
22
    {
23
        $names = array(
24
            'format_cell' => 'format_cell',
25
        );
26
27
        $funcs = array();
28
        foreach ($names as $twig => $local) {
29
            $funcs[$twig] = new \Twig_SimpleFilter($twig, [$this, $local]);
0 ignored issues
show
Bug introduced by
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...
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