YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/AdminAccess/views/Index.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using static access to class '\App\Utils' in method 'permissions'.
Open

        $viewer->view(\App\Utils::mbUcfirst($request->getMode()) . '.tpl', $qualifiedModuleName);

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 'Settings_AdminAccess_Module_Model' in method 'historyAdminsVisitPurpose'.
Open

        $viewer->assign('CONFIG_FIELDS', Settings_AdminAccess_Module_Model::getFields($qualifiedModuleName));

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\Utils' in method 'historyAdminsVisitPurpose'.
Open

        $viewer->view(\App\Utils::mbUcfirst($request->getMode()) . '.tpl', $qualifiedModuleName);

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 'Settings_Vtiger_Module_Model' in method 'historyAdminsVisitPurpose'.
Open

        $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);

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 'Settings_Vtiger_Module_Model' in method 'permissions'.
Open

        $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);

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\Config' in method 'historyAdminsVisitPurpose'.
Open

        $viewer->assign('CONFIG', App\Config::security());

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 'Settings_Vtiger_Module_Model' in method 'process'.
Open

        $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);

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 assigning values to variables in if clauses and the like (line '29', column '7').
Open

    public function process(App\Request $request)
    {
        if ($mode = $request->getMode()) {
            $this->invokeExposedMethod($mode, $request);
            return;

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

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

Define a constant instead of duplicating this literal "MODULE_MODEL" 3 times.
Open

        $viewer->assign('MODULE_MODEL', $moduleModel);

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('TAB', $request->has('tab') ? $request->getByType('tab') : 'permissions');

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('MODULE_MODEL', $moduleModel);

Call to undeclared method \Settings_Vtiger_Module_Model::getLinks
Open

        $viewer->assign('LINKS', $moduleModel->getLinks());

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('MODULE_MODEL', $moduleModel);

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('LINKS', $moduleModel->getLinks());

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('STRUCTURE', $moduleModel->getStructure('visitPurpose'));

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('CONFIG_FIELDS', Settings_AdminAccess_Module_Model::getFields($qualifiedModuleName));

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('MODULE_MODEL', $moduleModel);

Call to undeclared method \Settings_Vtiger_Module_Model::getStructure
Open

        $viewer->assign('STRUCTURE', $moduleModel->getStructure('visitPurpose'));

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('CONFIG', App\Config::security());

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class Settings_AdminAccess_Index_View extends Settings_Vtiger_Index_View

The class Settings_AdminAccess_Index_View is not named in CamelCase.
Open

class Settings_AdminAccess_Index_View extends Settings_Vtiger_Index_View
{
    /** {@inheritdoc} */
    public function __construct()
    {

CamelCaseClassName

Since: 0.2

It is considered best practice to use the CamelCase notation to name classes.

Example

class class_name {
}

Source

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

    public function __construct()

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

        }

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

        $viewer = $this->getViewer($request);

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

        $qualifiedModuleName = $request->getModule(false);

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

        parent::__construct();

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

        $viewer->assign('MODULE_MODEL', $moduleModel);

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

        $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);

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

     */

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

        $viewer->assign('MODULE_MODEL', $moduleModel);

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

        $viewer->assign('LINKS', $moduleModel->getLinks());

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

        $viewer->view(\App\Utils::mbUcfirst($request->getMode()) . '.tpl', $qualifiedModuleName);

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

        $viewer->assign('MODULE_MODEL', $moduleModel);

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

    /** {@inheritdoc} */

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

    }

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

            $this->invokeExposedMethod($mode, $request);

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

        $qualifiedModuleName = $request->getModule(false);

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

     * Gets permissions tab view.

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

     */

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

        $viewer = $this->getViewer($request);

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

        $viewer->assign('CONFIG_FIELDS', Settings_AdminAccess_Module_Model::getFields($qualifiedModuleName));

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

        $viewer->assign('CONFIG', App\Config::security());

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

        $viewer->assign('TAB', $request->has('tab') ? $request->getByType('tab') : 'permissions');

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

        $this->exposeMethod('permissions');

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

    public function process(App\Request $request)

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

            return;

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

        $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);

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

        $this->exposeMethod('historyAdminsVisitPurpose');

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

        if ($mode = $request->getMode()) {

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

        $qualifiedModuleName = $request->getModule(false);

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

        $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);

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

    }

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

        $viewer->assign('STRUCTURE', $moduleModel->getStructure('visitPurpose'));

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

        $viewer->view('Index.tpl', $qualifiedModuleName);

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

    public function permissions(App\Request $request)

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

    /** {@inheritdoc} */

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

    public function historyAdminsVisitPurpose(App\Request $request)

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

        $viewer = $this->getViewer($request);

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

     * Gets history admins visit purpose tab view.

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

        $viewer->view(\App\Utils::mbUcfirst($request->getMode()) . '.tpl', $qualifiedModuleName);

Class name "Settings_AdminAccess_Index_View" is not in camel caps format
Open

class Settings_AdminAccess_Index_View extends Settings_Vtiger_Index_View

There are no issues that match your filters.

Category
Status