Passed
Push — master ( 00c044...5a9be5 )
by Michael
02:49
created

MappingContext::getIdentifierHandler()   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
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
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
use Mikemirten\Component\JsonApi\Mapper\Handler\IdentifierHandler\IdentifierHandlerInterface;
8
use Mikemirten\Component\JsonApi\Mapper\Handler\TypeHandler\TypeHandlerInterface;
9
10
/**
11
 * Context of mapping
12
 *
13
 * @package Mikemirten\Component\JsonApi\Mapper
14
 */
15
class MappingContext
16
{
17
    /**
18
     * Object mapper
19
     *
20
     * @var ObjectMapper
21
     */
22
    protected $mapper;
23
24
    /**
25
     * Mapping definition
26
     *
27
     * @var Definition
28
     */
29
    protected $definition;
30
31
    /**
32
     * Identifier handler
33
     *
34
     * @var IdentifierHandlerInterface
35
     */
36
    protected $identifierHandler;
37
38
    /**
39
     * Type handler
40
     *
41
     * @var TypeHandlerInterface
42
     */
43
    protected $typeHandler;
44
45
    /**
46
     * MappingContext constructor.
47
     *
48
     * @param ObjectMapper               $mapper
49
     * @param Definition                 $definition
50
     * @param IdentifierHandlerInterface $identifierHandler,
0 ignored issues
show
Documentation introduced by
There is no parameter named $identifierHandler,. Did you maybe mean $identifierHandler?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
51
     * @param TypeHandlerInterface       $typeHandler
52
     */
53 3
    public function __construct(
54
        ObjectMapper               $mapper,
55
        Definition                 $definition,
56
        IdentifierHandlerInterface $identifierHandler,
57
        TypeHandlerInterface       $typeHandler
58
    ) {
59 3
        $this->mapper            = $mapper;
60 3
        $this->definition        = $definition;
61 3
        $this->identifierHandler = $identifierHandler;
62 3
        $this->typeHandler       = $typeHandler;
63 3
    }
64
65
    /**
66
     * Get object mapper
67
     *
68
     * @return ObjectMapper
69
     */
70 1
    public function getMapper(): ObjectMapper
71
    {
72 1
        return $this->mapper;
73
    }
74
75
    /**
76
     * Get mapping configuration
77
     *
78
     * @return Definition
79
     */
80 1
    public function getDefinition(): Definition
81
    {
82 1
        return $this->definition;
83
    }
84
85
    /**
86
     * Get identifier handler
87
     *
88
     * @return IdentifierHandlerInterface
89
     */
90 1
    public function getIdentifierHandler(): IdentifierHandlerInterface
91
    {
92 1
        return $this->identifierHandler;
93
    }
94
95
    /**
96
     * Get type handler
97
     *
98
     * @return TypeHandlerInterface
99
     */
100 1
    public function getTypeHandler(): TypeHandlerInterface
101
    {
102 1
        return $this->typeHandler;
103
    }
104
}