Completed
Push — master ( 1f140b...b7ffee )
by Dominik
02:02
created

LazyObjectMapping::getLinkMappings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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