Issues (42)

src/controllers/RoleController.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Itstructure\RbacModule\controllers;
4
5
use Itstructure\RbacModule\models\{Role, RoleSearch};
6
7
/**
8
 * Class RoleController
9
 * RoleController implements the CRUD actions for Role model.
10
 *
11
 * @package Itstructure\RbacModule\controllers
12
 */
13
class RoleController extends BaseController
14
{
15
    /**
16
     * Initialize.
17
     * Set viewPath and validateComponent.
18
     */
19
    public function init()
20
    {
21
        $this->viewPath = '@rbac/views/roles';
22
23
        $this->validateComponent = $this->module->get('rbac-validate-component');
24
25
        parent::init();
26
    }
27
28
    /**
29
     * Returns Role model name.
30
     *
31
     * @return string
32
     */
33
    protected function getModelName(): string
34
    {
35
        return Role::class;
36
    }
37
38
    /**
39
     * Returns RoleSearch model name.
40
     *
41
     * @return string|null
42
     */
43
    protected function getSearchModelName(): string
44
    {
45
        return RoleSearch::class;
46
    }
47
48
    /**
49
     * Returns new object of search main model.
50
     *
51
     * @return mixed
52
     */
53
    protected function getNewSearchModel()
54
    {
55
        return parent::getNewSearchModel()->setAuthManager($this->validateComponent->getAuthManager());
0 ignored issues
show
The method setAuthManager() does not exist on Itstructure\RbacModule\i...s\RbacIdentityInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

55
        return parent::getNewSearchModel()->/** @scrutinizer ignore-call */ setAuthManager($this->validateComponent->getAuthManager());

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...
56
    }
57
}
58