Passed
Push — master ( 4a36e4...d17d8f )
by Asmir
08:07 queued 05:11
created

SerializerRuntimeExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 23
rs 10
ccs 6
cts 6
cp 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFunctions() 0 4 1
A getFilters() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JMS\Serializer\Twig;
6
7
use Twig\TwigFilter;
8
use Twig\TwigFunction;
9
10
/**
11
 * @author Asmir Mustafic <[email protected]>
12
 */
13 1
final class SerializerRuntimeExtension extends SerializerBaseExtension
14
{
15 1
    /**
16
     * @return TwigFilter[]
17
     *
18 1
     * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint
19
     */
20
    public function getFilters()
21 1
    {
22
        return [
23
            new TwigFilter($this->serializationFunctionsPrefix . 'serialize', [SerializerRuntimeHelper::class, 'serialize']),
24
        ];
25 1
    }
26
27
    /**
28 1
     * @return TwigFunction[]
29
     *
30
     * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint
31
     */
32
    public function getFunctions()
33
    {
34
        return [
35
            new TwigFunction($this->serializationFunctionsPrefix . 'serialization_context', '\JMS\Serializer\SerializationContext::create'),
36
        ];
37
    }
38
}
39