Passed
Push — master ( dcd46e...faf454 )
by Dominik
03:03
created

DenormalizerContext::getRequest()   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\Denormalizer;
6
7
use Psr\Http\Message\ServerRequestInterface;
8
9
final class DenormalizerContext implements DenormalizerContextInterface
10
{
11
    /**
12
     * @var bool
13
     */
14
    private $allowedAdditionalFields = false;
15
16
    /**
17
     * @var string[]
18
     */
19
    private $groups = [];
20
21
    /**
22
     * @var ServerRequestInterface|null
23
     */
24
    private $request;
25
26
    /**
27
     * @param bool     $allowedAdditionalFields
28
     * @param string[] $groups
29
     * @param ServerRequestInterface|null $request
30
     */
31 2
    public function __construct(
32
        bool $allowedAdditionalFields = false,
33
        array $groups = [],
34
        ServerRequestInterface $request = null
35
    ) {
36 2
        $this->allowedAdditionalFields = $allowedAdditionalFields;
37 2
        $this->groups = $groups;
38 2
        $this->request = $request;
39 2
    }
40
41
    /**
42
     * @return bool
43
     */
44 2
    public function isAllowedAdditionalFields(): bool
45
    {
46 2
        return $this->allowedAdditionalFields;
47
    }
48
49
    /**
50
     * @return string[]
51
     */
52 2
    public function getGroups(): array
53
    {
54 2
        return $this->groups;
55
    }
56
57
    /**
58
     * @return ServerRequestInterface|null
59
     */
60 2
    public function getRequest()
61
    {
62 2
        return $this->request;
63
    }
64
}
65