| Conditions | 5 |
| Paths | 5 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { |
||
|
|
|||
| 21 | /** @var \Drupal\mongodb_watchdog\Entity\EventTemplateInterface $entity */ |
||
| 22 | switch ($operation) { |
||
| 23 | case 'view': |
||
| 24 | if (!$entity->isPublished()) { |
||
| 25 | return AccessResult::allowedIfHasPermission($account, 'view unpublished event template entities'); |
||
| 26 | } |
||
| 27 | return AccessResult::allowedIfHasPermission($account, 'view published event template entities'); |
||
| 28 | |||
| 29 | case 'update': |
||
| 30 | return AccessResult::allowedIfHasPermission($account, 'edit event template entities'); |
||
| 31 | |||
| 32 | case 'delete': |
||
| 33 | return AccessResult::allowedIfHasPermission($account, 'delete event template entities'); |
||
| 34 | } |
||
| 35 | |||
| 36 | // Unknown operation, no opinion. |
||
| 37 | return AccessResult::neutral(); |
||
| 38 | } |
||
| 39 | |||
| 48 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@returnannotation as described here.