LazyNormalizationObjectMapping::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Serialization\Mapping;
6
7
use Psr\Container\ContainerInterface;
8
9
final class LazyNormalizationObjectMapping implements NormalizationObjectMappingInterface
10
{
11
    /**
12
     * @var ContainerInterface
13
     */
14
    private $container;
15
16
    /**
17
     * @var string
18
     */
19
    private $serviceId;
20
21
    /**
22
     * @var string
23
     */
24
    private $class;
25
26
    /**
27
     * @param string $serviceId
28
     */
29
    public function __construct(ContainerInterface $container, $serviceId, string $class)
30
    {
31 1
        $this->container = $container;
32
        $this->serviceId = $serviceId;
33 1
        $this->class = $class;
34 1
    }
35 1
36 1
    public function getClass(): string
37
    {
38
        return $this->class;
39
    }
40
41 1
    /**
42
     * @return string|null
43 1
     */
44
    public function getNormalizationType()
45
    {
46
        return $this->container->get($this->serviceId)->getNormalizationType();
47
    }
48
49 1
    /**
50
     * @return NormalizationFieldMappingInterface[]
51 1
     */
52
    public function getNormalizationFieldMappings(string $path): array
53
    {
54
        return $this->container->get($this->serviceId)->getNormalizationFieldMappings($path);
55
    }
56
57
    /**
58
     * @return NormalizationFieldMappingInterface[]
59 1
     */
60
    public function getNormalizationEmbeddedFieldMappings(string $path): array
61 1
    {
62
        return $this->container->get($this->serviceId)->getNormalizationEmbeddedFieldMappings($path);
63
    }
64
65
    /**
66
     * @return NormalizationLinkMappingInterface[]
67
     */
68
    public function getNormalizationLinkMappings(string $path): array
69 1
    {
70
        return $this->container->get($this->serviceId)->getNormalizationLinkMappings($path);
71 1
    }
72
}
73