YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Workflows/views/CreateEntity.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

        $viewer->assign('FIELD_EXPRESSIONS', Settings_Workflows_Module_Model::getExpressions());

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 '31', column '8').
Open

    public function process(App\Request $request)
    {
        $viewer = $this->getViewer($request);
        $qualifiedModuleName = $request->getModule(false);
        $workflowModel = Settings_Workflows_Record_Model::getInstance($request->getInteger('for_workflow'));

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

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

        $workflowModel = Settings_Workflows_Record_Model::getInstance($request->getInteger('for_workflow'));

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

            $relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModule);

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('WORKFLOW_MODEL', $workflowModel);

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('FIELD_EXPRESSIONS', Settings_Workflows_Module_Model::getExpressions());

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('RELATED_MODULE_MODEL_NAME', '');

Call to undeclared method \Vtiger_Viewer::assign
Open

            $viewer->assign('RELATED_MODULE_MODEL', $relatedModuleModel);

Call to undeclared method \Vtiger_Viewer::assign
Open

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('REFERENCE_FIELD_NAME', $referenceFieldName);

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('MAPPING_PANEL', $request->get('mappingPanel'));

Call to undeclared method \Vtiger_Viewer::assign
Open

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('SOURCE_MODULE', $workflowModuleModel->getName());

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

class Settings_Workflows_CreateEntity_View extends Settings_Vtiger_Index_View

The class Settings_Workflows_CreateEntity_View is not named in CamelCase.
Open

class Settings_Workflows_CreateEntity_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

            $relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModule);

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

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

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

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

            $relatedModule = $request->getByType('relatedModule', 2);

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

            if ($fieldModel = current($relatedModuleModel->getReferenceFieldsForModule($workflowModel->getModule()->getName()))) {

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

                $referenceFieldName = $fieldModel->getName();

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

        $workflowModuleModel = $workflowModel->getModule();

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

        $viewer->assign('REFERENCE_FIELD_NAME', $referenceFieldName);

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

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

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

        if ($request->has('relatedModule')) {

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

            $viewer->assign('RELATED_MODULE_MODEL', $relatedModuleModel);

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('MAPPING_PANEL', $request->get('mappingPanel'));

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

        $viewer->assign('FIELD_EXPRESSIONS', Settings_Workflows_Module_Model::getExpressions());

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

        $viewer->assign('WORKFLOW_MODEL', $workflowModel);

Line exceeds 120 characters; contains 130 characters
Open

            if ($fieldModel = current($relatedModuleModel->getReferenceFieldsForModule($workflowModel->getModule()->getName()))) {

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

        $viewer->assign('RELATED_MODULE_MODEL_NAME', '');

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

        $referenceFieldName = '';

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

     * Main process.

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

     */

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

        $workflowModel = Settings_Workflows_Record_Model::getInstance($request->getInteger('for_workflow'));

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

class Settings_Workflows_CreateEntity_View extends Settings_Vtiger_Index_View

There are no issues that match your filters.

Category
Status