Completed
Push — master ( bd3639...0febda )
by Kévin
03:53
created

setSerializerLocator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace ApiPlatform\Core\DataProvider;
15
16
use Psr\Container\ContainerInterface;
17
use Symfony\Component\Serializer\SerializerInterface;
18
19
/**
20
 * Injects serializer in data providers.
21
 *
22
 * @author Vincent Chalamon <[email protected]>
23
 */
24
trait SerializerAwareDataProviderTrait
25
{
26
    /**
27
     * @internal
28
     *
29
     * @var ContainerInterface
30
     */
31
    private $serializerLocator;
32
33
    public function setSerializerLocator(ContainerInterface $serializerLocator)
34
    {
35
        $this->serializerLocator = $serializerLocator;
36
    }
37
38
    private function getSerializer(): SerializerInterface
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
39
    {
40
        return $this->serializerLocator->get('serializer');
41
    }
42
}
43