Completed
Push — master ( 6db6da...5370d9 )
by Angel
03:42
created

Action   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkAccess() 0 12 3
1
<?php
2
3
namespace roaresearch\yii2\roa\actions;
4
5
use yii\db\ActiveRecordInterface;
6
7
class Action extends \yii\rest\Action
8
{
9
    /**
10
     * @param ActiveRecordInterface $model
11
     * @param array $params
12
     * @throws \yii\web\HTTPException
13
     */
14
    public function checkAccess(
15
        ActiveRecordInterface $model,
16
        array $params = []
17
    ) {
18
        $this->controller->checkAccess($this->id, $model, $params);
19
        if ($model->hasMethod('checkAccess')) {
20
            $model->checkAccess($params);
0 ignored issues
show
Bug introduced by
The method checkAccess() does not seem to exist on object<yii\db\ActiveRecordInterface>.

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.

Loading history...
21
        }
22
        if (isset($this->checkAccess)) {
23
            call_user_func($this->checkAccess, $this, $model, $params);
24
        }
25
    }
26
}
27