MappingContext::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
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\Definition;
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 Definition
26
     */
27
    protected $definition;
28
29
    /**
30
     * MappingContext constructor.
31
     *
32
     * @param ObjectMapper $mapper
33
     * @param Definition   $definition
34
     */
35 4
    public function __construct(ObjectMapper $mapper, Definition $definition) {
36 4
        $this->mapper     = $mapper;
37 4
        $this->definition = $definition;
38 4
    }
39
40
    /**
41
     * Get object mapper
42
     *
43
     * @return ObjectMapper
44
     */
45 1
    public function getMapper(): ObjectMapper
46
    {
47 1
        return $this->mapper;
48
    }
49
50
    /**
51
     * Get mapping configuration
52
     *
53
     * @return Definition
54
     */
55 3
    public function getDefinition(): Definition
56
    {
57 3
        return $this->definition;
58
    }
59
}