Total Complexity | 4 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class UserIsNotLoggedIntoRole implements Rule |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * @var Authentication |
||
13 | */ |
||
14 | private $authentication; |
||
15 | |||
16 | 6 | public function __construct(Authentication $authentication) |
|
17 | { |
||
18 | 6 | $this->authentication = $authentication; |
|
19 | 6 | } |
|
20 | |||
21 | /** |
||
22 | * @inheritDoc |
||
23 | */ |
||
24 | 1 | public function passes($attribute, $value) |
|
25 | { |
||
26 | 1 | return $this->authentication->getRole() === null || |
|
27 | 1 | $this->authentication->getRole()->id() !== (int) $value; |
|
28 | } |
||
29 | |||
30 | /** |
||
31 | * @inheritDoc |
||
32 | */ |
||
33 | 1 | public function message() |
|
36 | } |
||
37 | } |