YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

The method process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            if (!isset($supportedModules)) {
                $supportedModules = Settings_CustomView_Module_Model::getSupportedModules();
            }
            $viewer->assign('SUPPORTED_MODULE_MODELS', $supportedModules);

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

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 using static access to class 'Settings_CustomView_Module_Model' in method 'process'.
Open

            $supportedModules = Settings_CustomView_Module_Model::getSupportedModules();

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

                $supportedModules = Settings_CustomView_Module_Model::getSupportedModules();

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 undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('SOURCE_MODULE', $supportedModule);

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);

Call to undeclared method \Vtiger_Viewer::assign
Open

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

Call to undeclared method \Vtiger_Viewer::assign
Open

            $viewer->assign('SUPPORTED_MODULE_MODELS', $supportedModules);

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('MODULE', $moduleName);

Saw unextractable annotation for comment '* @return <array> - List of Vtiger_JsScript_Model instances'</array>
Open

     * @return <Array> - List of Vtiger_JsScript_Model instances

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

class Settings_CustomView_Index_View extends Settings_Vtiger_Index_View

The class Settings_CustomView_Index_View is not named in CamelCase.
Open

class Settings_CustomView_Index_View extends Settings_Vtiger_Index_View
{
    /**
     * Main process.
     *

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

        $supportedModule = $request->getByType('sourceModule', \App\Purifier::ALNUM);

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

            $supportedModules = Settings_CustomView_Module_Model::getSupportedModules();

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->view('Index.tpl', $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

     * Main process.

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

        if ($request->isAjax()) {

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

     * @return <Array> - List of Vtiger_JsScript_Model instances

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('QUALIFIED_MODULE', $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

    /**

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

            $viewer->assign('SUPPORTED_MODULE_MODELS', $supportedModules);

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('MODULE', $moduleName);

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

        $jsFileNames = [

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

        $moduleName = $request->getModule();

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

        if (empty($supportedModule)) {

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('SOURCE_MODULE', $supportedModule);

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 process(App\Request $request)

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

     * Function to get the list of Script models to be included.

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

        $jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);

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

        $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

            if (!isset($supportedModules)) {

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

        } else {

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

                $supportedModules = Settings_CustomView_Module_Model::getSupportedModules();

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

     * @param \App\Request $request

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

    public function getFooterScripts(App\Request $request)

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

        return array_merge(parent::getFooterScripts($request), $jsScriptInstances);

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

    {

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

            $supportedModule = reset($supportedModules);

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->view('IndexContents.tpl', $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

            'modules.CustomView.resources.CustomView',

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

        ];

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

class Settings_CustomView_Index_View extends Settings_Vtiger_Index_View

There are no issues that match your filters.

Category
Status