Passed
Pull Request — master (#3)
by
unknown
04:02
created

DenormalizerContext   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 56
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getGroups() 0 4 1
A getRequest() 0 4 1
A getAllowedAdditionalFields() 0 4 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
     * @param array|null                  $allowedAdditionalFields
28
     * @param string[]                    $groups
29
     * @param ServerRequestInterface|null $request
30
     */
31 2
    public function __construct(
32
        array $allowedAdditionalFields = null,
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 array|null
43
     */
44 2
    public function getAllowedAdditionalFields()
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