Total Complexity | 6 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
8 | trait ResolvesAuthorization |
||
9 | { |
||
10 | 53 | protected function resolveAuthorization() |
|
11 | { |
||
12 | 53 | if (! $this->passesAuthorization()) { |
|
13 | 2 | $this->failedAuthorization(); |
|
14 | } |
||
15 | |||
16 | 51 | return $this; |
|
17 | } |
||
18 | |||
19 | 55 | public function passesAuthorization() |
|
26 | } |
||
27 | |||
28 | 2 | protected function failedAuthorization() |
|
29 | { |
||
30 | 2 | throw new AuthorizationException('This action is unauthorized.'); |
|
31 | } |
||
32 | |||
33 | 2 | protected function can($ability, $arguments = []) |
|
36 | } |
||
37 | } |
||
38 |