| Total Complexity | 12 |
| Total Lines | 69 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 14 | class AccessBehavior extends Behavior |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | public $permission = ''; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | public $role = ''; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @inheritdoc |
||
| 28 | * @return array |
||
| 29 | */ |
||
| 30 | public function events() |
||
| 34 | ]; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @inheritdoc |
||
| 39 | */ |
||
| 40 | public function accessAction() |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @return bool |
||
| 49 | */ |
||
| 50 | protected function checkPermission() |
||
| 51 | { |
||
| 52 | if (!empty($this->permission)) { |
||
| 53 | if (Yii::$app->user->can($this->permission)) { |
||
|
|
|||
| 54 | return true; |
||
| 55 | } |
||
| 56 | } |
||
| 57 | return false; |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @return bool |
||
| 62 | */ |
||
| 63 | protected function checkRole() |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Logout and set Flash message |
||
| 75 | */ |
||
| 76 | private function processLogout() |
||
| 87 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.