YetiForceCompany/YetiForceCRM

View on GitHub
app/Controller/Traits/SettingsPermission.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '31', column '14').
Open

            throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Avoid using static access to class '\App\Session' in method 'checkPermission'.
Open

        if (!empty(\Config\Security::$askSuperUserAboutVisitPurpose) && !\App\Session::has('showedModalVisitPurpose') && !\App\User::getCurrentUserModel()->isAdmin()) {

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\Security\AdminAccess' in method 'checkPermission'.
Open

        if (!\App\Security\AdminAccess::isPermitted($request->getModule())) {

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\Process' in method 'checkPermission'.
Open

            \App\Process::addEvent([
                'name' => 'showSuperUserVisitPurpose',
                'type' => 'modal',
                'url' => 'index.php?module=Users&view=VisitPurpose',
            ]);

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Call to method getCurrentUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
Open

        if (!empty(\Config\Security::$askSuperUserAboutVisitPurpose) && !\App\Session::has('showedModalVisitPurpose') && !\App\User::getCurrentUserModel()->isAdmin()) {

Spaces must be used to indent lines; tabs are not allowed
Open

        if (!\App\Security\AdminAccess::isPermitted($request->getModule())) {

Spaces must be used to indent lines; tabs are not allowed
Open

            ]);

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param \App\Request $request

Spaces must be used to indent lines; tabs are not allowed
Open

     * @throws \App\Exceptions\NoPermittedForAdmin

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

            \App\Process::addEvent([

Spaces must be used to indent lines; tabs are not allowed
Open

                'name' => 'showSuperUserVisitPurpose',

Spaces must be used to indent lines; tabs are not allowed
Open

                'type' => 'modal',

Spaces must be used to indent lines; tabs are not allowed
Open

                'url' => 'index.php?module=Users&view=VisitPurpose',

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * Only administrator user can access settings.

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

        if (!empty(\Config\Security::$askSuperUserAboutVisitPurpose) && !\App\Session::has('showedModalVisitPurpose') && !\App\User::getCurrentUserModel()->isAdmin()) {

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    public function checkPermission(\App\Request $request)

Spaces must be used to indent lines; tabs are not allowed
Open

            throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

Line exceeds 120 characters; contains 168 characters
Open

        if (!empty(\Config\Security::$askSuperUserAboutVisitPurpose) && !\App\Session::has('showedModalVisitPurpose') && !\App\User::getCurrentUserModel()->isAdmin()) {

There are no issues that match your filters.

Category
Status