Passed
Pull Request — master (#24)
by Dominik
02:13
created

DenormalizerContext::isResetMissingFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

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
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Deserialization\Denormalizer;
6
7
use Psr\Http\Message\ServerRequestInterface;
8
9
final class DenormalizerContext implements DenormalizerContextInterface
10
{
11
    /**
12
     * @var array|null
13
     */
14
    private $allowedAdditionalFields;
15
16
    /**
17
     * @var string[]
18
     */
19
    private $groups = [];
20
21
    /**
22
     * @var ServerRequestInterface|null
23
     */
24
    private $request;
25
26
    /**
27
     * @var bool
28
     */
29
    private $resetMissingFields;
30
31
    /**
32
     * @param array|null                  $allowedAdditionalFields
33
     * @param string[]                    $groups
34
     * @param ServerRequestInterface|null $request
35
     * @param bool                        $resetMissingFields
36
     */
37 2
    public function __construct(
38
        array $allowedAdditionalFields = null,
39
        array $groups = [],
40
        ServerRequestInterface $request = null,
41
        bool $resetMissingFields = false
42
    ) {
43 2
        $this->allowedAdditionalFields = $allowedAdditionalFields;
44 2
        $this->groups = $groups;
45 2
        $this->request = $request;
46 2
        $this->resetMissingFields = $resetMissingFields;
47 2
    }
48
49
    /**
50
     * @return array|null
51
     */
52 2
    public function getAllowedAdditionalFields()
53
    {
54 2
        return $this->allowedAdditionalFields;
55
    }
56
57
    /**
58
     * @return string[]
59
     */
60 2
    public function getGroups(): array
61
    {
62 2
        return $this->groups;
63
    }
64
65
    /**
66
     * @return ServerRequestInterface|null
67
     */
68 2
    public function getRequest()
69
    {
70 2
        return $this->request;
71
    }
72
73
    /**
74
     * @return bool
75
     */
76 2
    public function isResetMissingFields(): bool
77
    {
78 2
        return $this->resetMissingFields;
79
    }
80
}
81