Passed
Push — master ( 1d1b3b...024fd5 )
by Pol
02:36
created

VarExportExtension::export()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace drupol\ComposerPackages\Twig;
6
7
use Twig\Extension\AbstractExtension;
8
use Twig\TwigFilter;
9
10
/**
11
 * Class CamelCaseExtension.
12
 */
13
class VarExportExtension extends AbstractExtension
14
{
15
    /**
16
     * @param mixed $data
17
     *
18
     * @return string
19
     *   The exported variable.
20
     */
21 2
    public function export($data): string
22
    {
23 2
        return var_export($data, true);
24
    }
25
26
    /**
27
     * Returns a list of filters to add to the existing list.
28
     *
29
     * @return TwigFilter[]
30
     */
31 1
    public function getFilters()
32
    {
33
        return [
34 1
            new TwigFilter('export', [$this, 'export'], ['is_safe' => ['html']]),
35
        ];
36
    }
37
}
38