Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0175 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | 2 | public function assert(Acl $acl, ?RoleInterface $role = null, ?ResourceInterface $resource = null, $privilege = null) |
|
27 | { |
||
28 | 2 | if ($resource === null) { |
|
29 | return false; |
||
30 | } |
||
31 | |||
32 | /** @var Bookable $bookable */ |
||
33 | 2 | $bookable = $resource->getInstance(); |
|
34 | |||
35 | 2 | $bookingType = $bookable->getBookingType(); |
|
36 | 2 | if ($bookingType === BookingTypeType::ADMIN_ONLY) { |
|
37 | 1 | return true; |
|
38 | } |
||
39 | |||
40 | 1 | return $acl->reject('the booking type for this bookable is not admin only, but : ' . $bookingType); |
|
41 | } |
||
43 |