Passed
Push — master ( 5f6485...00c044 )
by Michael
02:31
created

MappingContext::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Mikemirten\Component\JsonApi\Mapper;
5
6
use Mikemirten\Component\JsonApi\Mapper\Definition\DefinitionInterface;
7
8
/**
9
 * Context of mapping
10
 *
11
 * @package Mikemirten\Component\JsonApi\Mapper
12
 */
13
class MappingContext
14
{
15
    /**
16
     * Object mapper
17
     *
18
     * @var ObjectMapper
19
     */
20
    protected $mapper;
21
22
    /**
23
     * Mapping definition
24
     *
25
     * @var DefinitionInterface
26
     */
27
    protected $definition;
28
29
    /**
30
     * MappingContext constructor.
31
     *
32
     * @param ObjectMapper        $mapper
33
     * @param DefinitionInterface $definition
34
     */
35 3
    public function __construct(ObjectMapper $mapper, DefinitionInterface $definition)
36
    {
37 3
        $this->mapper     = $mapper;
38 3
        $this->definition = $definition;
39 3
    }
40
41
    /**
42
     * Get object mapper
43
     *
44
     * @return ObjectMapper
45
     */
46 1
    public function getMapper(): ObjectMapper
47
    {
48 1
        return $this->mapper;
49
    }
50
51
    /**
52
     * Get mapping configuration
53
     *
54
     * @return DefinitionInterface
55
     */
56 1
    public function getDefinition(): DefinitionInterface
57
    {
58 1
        return $this->definition;
59
    }
60
}