Completed
Push — 6.13 ( 7401a7...8452de )
by
unknown
18:35
created

SerializerTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 13
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
namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;
8
9
use Symfony\Component\Serializer\Encoder\JsonEncoder;
10
use Symfony\Component\Serializer\Normalizer\PropertyNormalizer;
11
use Symfony\Component\Serializer\Serializer;
12
13
trait SerializerTrait
14
{
15
    /**
16
     * @return \Symfony\Component\Serializer\SerializerInterface
17
     */
18
    public function getSerializer()
19
    {
20
        return new Serializer(
21
            [(new PropertyNormalizer())->setIgnoredAttributes(['request'])],
22
            [new JsonEncoder()]
23
        );
24
    }
25
}
26