Completed
Pull Request — master (#12)
by Dominik
07:37 queued 14s
created

NormalizerContext::getRole()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Serialization\Normalizer;
6
7
use Psr\Http\Message\ServerRequestInterface;
8
9
final class NormalizerContext implements NormalizerContextInterface
10
{
11
    /**
12
     * @var string[]
13
     */
14
    private $groups = [];
15
16
    /**
17
     * @var ServerRequestInterface|null
18
     */
19
    private $request;
20
21
    /**
22
     * @var object|string|null
23
     */
24
    private $role;
25
26
    /**
27
     * @param string[]                    $groups
28
     * @param ServerRequestInterface|null $request
29
     * @param object|string|null          $role
30
     */
31 2
    public function __construct(array $groups = [], ServerRequestInterface $request = null, $role = null)
32
    {
33 2
        $this->groups = $groups;
34 2
        $this->request = $request;
35 2
        $this->role = $role;
36 2
    }
37
38
    /**
39
     * @return string[]
40
     */
41 2
    public function getGroups(): array
42
    {
43 2
        return $this->groups;
44
    }
45
46
    /**
47
     * @return ServerRequestInterface|null
48
     */
49 2
    public function getRequest()
50
    {
51 2
        return $this->request;
52
    }
53
54
    /**
55
     * @return object|string|null
56
     */
57
    public function getRole()
58
    {
59
        return $this->role;
60
    }
61
}
62