YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/WebserviceApps/views/CreateApp.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using static access to class 'Settings_WebserviceApps_Record_Model' in method 'process'.
Open

            $recordModel = Settings_WebserviceApps_Record_Model::getInstanceById($request->getInteger('record'));

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

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 {
            $type = $request->getByType('type') ?: current(\Api\Core\Containers::$list);
            $recordModel = false;
        }

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 unused parameters such as '$request'.
Open

    public function getSize(App\Request $request)

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Call to undeclared method \Vtiger_Viewer::assign
Open

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('APP_TYPE', $type);

Call to undeclared method \Vtiger_Viewer::assign
Open

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('API_FIELDS', ['SMS' => ['name' => 'M', 'status' => 'M', 'type' => 'M', 'ips' => 'M']]);

Call to undeclared method \Vtiger_Viewer::assign
Open

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

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

class Settings_WebserviceApps_CreateApp_View extends Settings_Vtiger_BasicModal_View

The class Settings_WebserviceApps_CreateApp_View is not named in CamelCase.
Open

class Settings_WebserviceApps_CreateApp_View extends Settings_Vtiger_BasicModal_View
{
    public function getSize(App\Request $request)
    {
        return 'modal-lg';

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

        return 'modal-lg';

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

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

        parent::preProcess($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

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

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

    {

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

            $type = $request->getByType('type') ?: current(\Api\Core\Containers::$list);

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

        $viewer->assign('API_FIELDS', ['SMS' => ['name' => 'M', 'status' => 'M', 'type' => 'M', 'ips' => 'M']]);

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('APP_TYPE', $type);

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

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

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

            $type = $recordModel->get('type');

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

    }

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

        if (!$request->isEmpty('record')) {

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

        }

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

            $recordModel = Settings_WebserviceApps_Record_Model::getInstanceById($request->getInteger('record'));

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

            $recordModel = false;

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

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

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

class Settings_WebserviceApps_CreateApp_View extends Settings_Vtiger_BasicModal_View

There are no issues that match your filters.

Category
Status