YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/dashboards/ListUpdatedRecord.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

        $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());

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 {
            $number = 'all';
        }

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

        $currentUser = Users_Record_Model::getCurrentUserModel();

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

        $recordList = ListUpdatedRecord::getListRecord(null, $columnList, $number);

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 {
            $viewer->view('dashboards/ListUpdatedRecord.tpl', $moduleName);
        }

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('LIST', $recordList);

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('DATA', $data);

Call to method getInstance from undeclared class \Vtiger_Widget_Model
Open

        $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());

Call to undeclared method \Vtiger_Viewer::assign
Open

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('WIDGET', $widget);

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('COLUMN_LIST', $columnList);

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

class Vtiger_ListUpdatedRecord_Dashboard extends Vtiger_IndexAjax_View

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 14 and the first side effect is on line 12.
Open

<?php

The class Vtiger_ListUpdatedRecord_Dashboard is not named in CamelCase.
Open

class Vtiger_ListUpdatedRecord_Dashboard extends Vtiger_IndexAjax_View
{
    public function process(App\Request $request)
    {
        $currentUser = Users_Record_Model::getCurrentUserModel();

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

        $currentUser = Users_Record_Model::getCurrentUserModel();

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

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('LIST', $recordList);

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

        } else {

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

        $viewer->assign('COLUMN_LIST', $columnList);

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

        $data = $request->getAll();

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

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

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

        $recordList = ListUpdatedRecord::getListRecord(null, $columnList, $number);

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

            $viewer->view('dashboards/ListUpdatedRecordContents.tpl', $moduleName);

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

        $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());

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

        $viewer->assign('WIDGET', $widget);

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

        }

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

            $number = $request->getInteger('number');

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

        $linkId = $request->getInteger('linkid');

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

            $number = 'all';

Line exceeds 120 characters; contains 143 characters
Open

        $columnList = ['LBL_NAME' => 'label', 'LBL_MODULE_NAME' => 'setype', 'Last Modified By' => 'modifiedtime', 'LBL_OWNER' => 'smownerid'];

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

        $columnList = ['LBL_NAME' => 'label', 'LBL_MODULE_NAME' => 'setype', 'Last Modified By' => 'modifiedtime', 'LBL_OWNER' => 'smownerid'];

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

            $viewer->view('dashboards/ListUpdatedRecord.tpl', $moduleName);

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

        $viewer->assign('DATA', $data);

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

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

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

class Vtiger_ListUpdatedRecord_Dashboard extends Vtiger_IndexAjax_View

There are no issues that match your filters.

Category
Status