LazyDenormalizationObjectMapping   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
c 1
b 0
f 1
dl 0
loc 43
ccs 7
cts 7
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getClass() 0 3 1
A getDenormalizationFieldMappings() 0 3 1
A __construct() 0 5 1
A getDenormalizationFactory() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Deserialization\Mapping;
6
7
use Psr\Container\ContainerInterface;
8
9
final class LazyDenormalizationObjectMapping implements DenormalizationObjectMappingInterface
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
    public function getDenormalizationFactory(string $path, string $type = null): callable
42
    {
43 1
        return $this->container->get($this->serviceId)->getDenormalizationFactory($path, $type);
44
    }
45
46
    /**
47
     * @return DenormalizationFieldMappingInterface[]
48
     */
49
    public function getDenormalizationFieldMappings(string $path, string $type = null): array
50
    {
51
        return $this->container->get($this->serviceId)->getDenormalizationFieldMappings($path, $type);
52 1
    }
53
}
54