Passed
Push — master ( bc9d1b...b1e342 )
by Dominik
02:00
created

LazyObjectMapping   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 69
ccs 0
cts 26
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getClass() 0 4 1
A getFieldMappings() 0 4 1
A getEmbeddedFieldMappings() 0 4 1
A getLinkMappings() 0 4 1
A getType() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Serialization\Mapping;
6
7
use Interop\Container\ContainerInterface;
8
9
final class LazyObjectMapping implements ObjectMappingInterface
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 ContainerInterface $container
28
     * @param string             $serviceId
29
     * @param string             $class
30
     */
31
    public function __construct(ContainerInterface $container, string $serviceId, string $class)
32
    {
33
        $this->container = $container;
34
        $this->serviceId = $serviceId;
35
        $this->class = $class;
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getClass(): string
42
    {
43
        return $this->class;
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getType(): string
50
    {
51
        return $this->container->get($this->serviceId)->getType();
52
    }
53
54
    /**
55
     * @return FieldMappingInterface[]
56
     */
57
    public function getFieldMappings(): array
58
    {
59
        return $this->container->get($this->serviceId)->getFieldMappings();
60
    }
61
62
    /**
63
     * @return FieldMappingInterface[]
64
     */
65
    public function getEmbeddedFieldMappings(): array
66
    {
67
        return $this->container->get($this->serviceId)->getEmbeddedFieldMappings();
68
    }
69
70
    /**
71
     * @return LinkMappingInterface[]
72
     */
73
    public function getLinkMappings(): array
74
    {
75
        return $this->container->get($this->serviceId)->getLinkMappings();
76
    }
77
}
78