Completed
Pull Request — master (#6)
by Ondrej
02:53
created

IdentityContext::getRoles()   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
namespace SpareParts\Overseer\Context;
3
4
/**
5
 * Default implementation of classic "user identity" context, used in many role-based authenticators.
6
 */
7
class IdentityContext implements IIdentityContext
8
{
9
10
    /**
11
     * @var mixed
12
     */
13
    private $id;
14
15
    /**
16
     * @var string[]
17
     */
18
    private $roles;
19
20
21
    /**
22
     * VotingContext constructor.
23
     * @param mixed $id
24
     * @param string[] $roles
25
     */
26
    public function __construct($id, array $roles)
27
    {
28
        $this->id = $id;
29
        $this->roles = $roles;
30
    }
31
32
33
    /**
34
     * @return mixed
35
     */
36
    public function getId()
37
    {
38
        return $this->id;
39
    }
40
41
42
    /**
43
     * @return string[]
44
     */
45 3
    public function getRoles()
46
    {
47 3
        return $this->roles;
48
    }
49
}
50