Passed
Push — master ( 76905c...77eacf )
by Dominik
02:23
created

LazyDenormalizationObjectMapping::getClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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 ContainerInterface $container
28
     * @param string             $serviceId
29
     * @param string             $class
30
     */
31 1
    public function __construct(ContainerInterface $container, $serviceId, string $class)
32
    {
33 1
        $this->container = $container;
34 1
        $this->serviceId = $serviceId;
35 1
        $this->class = $class;
36 1
    }
37
38
    /**
39
     * @return string
40
     */
41 1
    public function getClass(): string
42
    {
43 1
        return $this->class;
44
    }
45
46
    /**
47
     * @param string|null $type
48
     *
49
     * @return callable
50
     */
51 1
    public function getDenormalizationFactory(string $type = null): callable
52
    {
53 1
        return $this->container->get($this->serviceId)->getDenormalizationFactory($type);
54
    }
55
56
    /**
57
     * @param string|null $type
58
     *
59
     * @return DenormalizationFieldMappingInterface[]
60
     */
61 1
    public function getDenormalizationFieldMappings(string $type = null): array
62
    {
63 1
        return $this->container->get($this->serviceId)->getDenormalizationFieldMappings($type);
64
    }
65
}
66