Completed
Push — EZP-31460 ( fb49b1...efa331 )
by
unknown
19:23 queued 11s
created

SerializerTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getSerializer() 0 7 1
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;
10
11
use Symfony\Component\Serializer\Encoder\JsonEncoder;
12
use Symfony\Component\Serializer\Normalizer\PropertyNormalizer;
13
use Symfony\Component\Serializer\Serializer;
14
use Symfony\Component\Serializer\SerializerInterface;
15
16
trait SerializerTrait
17
{
18
    public function getSerializer(): SerializerInterface
19
    {
20
        return new Serializer(
21
            [(new PropertyNormalizer())->setIgnoredAttributes(['request', 'container', 'matcherBuilder'])],
22
            [new JsonEncoder()]
23
        );
24
    }
25
}
26