YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Inventory/views/CreditLimits.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '39', column '22').
Open

        $recordModel = new Settings_Inventory_Record_Model();

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

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

        $allData = Settings_Inventory_Record_Model::getDataAll($view);

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

        $viewer->assign('CURRENCY', Vtiger_Util_Helper::getBaseCurrency());

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 getPageLabels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $view = $request->getByType('view', 1);
        }

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 processTplName(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

Suspicious argument \App\Controller\type for an echo/print statement
Open

            echo $this->invokeExposedMethod($mode, $request);

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('INVENTORY_DATA', $allData);

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('CURRENCY', Vtiger_Util_Helper::getBaseCurrency());

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('PAGE_LABELS', $this->getPageLabels($request));

Call to undeclared method \Vtiger_Viewer::assign
Open

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('VIEW', $view);

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

class Settings_Inventory_CreditLimits_View extends Settings_Vtiger_Index_View

The class Settings_Inventory_CreditLimits_View is not named in CamelCase.
Open

class Settings_Inventory_CreditLimits_View extends Settings_Vtiger_Index_View
{
    use \App\Controller\ExposeMethod;

    public function getView()

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

        $viewer->assign('VIEW', $view);

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

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

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

        $translations = [];

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

            return;

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

        $allData = Settings_Inventory_Record_Model::getDataAll($view);

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('PAGE_LABELS', $this->getPageLabels($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

            echo $this->invokeExposedMethod($mode, $request);

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

        $translations['title'] = 'LBL_' . strtoupper($view);

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

        $translations['title_single'] = 'LBL_' . strtoupper($view) . '_SINGLE';

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

     * Process template name.

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

    public function processTplName(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

        if (!empty($mode)) {

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

        $viewer->assign('INVENTORY_DATA', $allData);

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->setType($view);

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

    {

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

        }

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

        return $translations;

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

    use \App\Controller\ExposeMethod;

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

    public function getPageLabels(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

        $view = $this->getView();

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

        $recordModel = new Settings_Inventory_Record_Model();

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

        $viewer->assign('CURRENCY', Vtiger_Util_Helper::getBaseCurrency());

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

            $view = $request->getByType('type', 'Standard');

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

     * @return string

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

        $mode = $request->getMode();

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

    public function getView()

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

            $view = $request->getByType('view', 1);

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

        $viewer->view($this->processTplName($request), $qualifiedModuleName);

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

        return 'Index.tpl';

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

    {

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

        return 'CreditLimits';

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

        $translations['description'] = 'LBL_' . strtoupper($view) . '_DESCRIPTION';

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

class Settings_Inventory_CreditLimits_View extends Settings_Vtiger_Index_View

There are no issues that match your filters.

Category
Status