YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/PBX/views/EditModal.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 {
            $recordModel = Settings_PBX_Record_Model::getCleanInstance();
        }

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

            $recordModel = Settings_PBX_Record_Model::getInstanceById($recordId);

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

            $recordModel = Settings_PBX_Record_Model::getCleanInstance();

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('RECORD', $recordId);
Severity: Critical
Found in modules/Settings/PBX/views/EditModal.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('RECORD_MODEL', $recordModel);
Severity: Critical
Found in modules/Settings/PBX/views/EditModal.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('CONNECTOR_CONFIG', $request->getBoolean('connectorConfig'));
Severity: Critical
Found in modules/Settings/PBX/views/EditModal.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('MODULE_MODEL', $recordModel->getModule());
Severity: Critical
Found in modules/Settings/PBX/views/EditModal.php by phan

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

class Settings_PBX_EditModal_View extends Settings_Vtiger_BasicModal_View

The class Settings_PBX_EditModal_View is not named in CamelCase.
Open

class Settings_PBX_EditModal_View extends Settings_Vtiger_BasicModal_View
{
    /**
     * 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

    }

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

    /**

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

            $recordModel = Settings_PBX_Record_Model::getInstanceById($recordId);

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

        if ($request->getBoolean('connectorConfig')) {

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

        parent::postProcess($request);

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

        parent::preProcess($request);

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

        $viewer->assign('RECORD_MODEL', $recordModel);

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('CONNECTOR_CONFIG', $request->getBoolean('connectorConfig'));

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

     */

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

            $recordModel->set('type', $request->getByType('type', 'Alnum'));

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

     * Process.

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

            $recordModel = Settings_PBX_Record_Model::getCleanInstance();

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

     * @param \App\Request $request

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

        if ($recordId) {

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

        $viewer->assign('MODULE_MODEL', $recordModel->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

    {

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

        $viewer->assign('RECORD', $recordId);

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

        $recordId = $request->getInteger('record');

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

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

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

class Settings_PBX_EditModal_View extends Settings_Vtiger_BasicModal_View

There are no issues that match your filters.

Category
Status