Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4.0312 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | 29 | public function view(User $user, Url $url): bool |
|
23 | { |
||
24 | 29 | if ($user->hasPermissionTo('url:view:any')) { |
|
25 | 12 | return true; |
|
26 | } |
||
27 | |||
28 | 17 | if (! $user->hasPermissionTo('url:view')) { |
|
29 | return true; |
||
30 | } |
||
31 | |||
32 | 17 | if ($user->id === $url->user_id) { |
|
33 | 11 | return true; |
|
34 | } |
||
35 | |||
36 | 7 | return false; |
|
37 | } |
||
82 |