YetiForceCompany/YetiForceCRM

View on GitHub
modules/Project/views/Gantt.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

The method preProcess has a boolean flag argument $display, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function preProcess(App\Request $request, $display = true)
Severity: Minor
Found in modules/Project/views/Gantt.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The method postProcess has a boolean flag argument $display, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function postProcess(App\Request $request, $display = true)
Severity: Minor
Found in modules/Project/views/Gantt.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Avoid using static access to class '\App\Language' in method 'process'.
Open

            $viewer->assign('GANTT_TITLE', \App\Language::translate('LBL_GANTT_TITLE_ALL_PROJECTS', 'Project'));
Severity: Minor
Found in modules/Project/views/Gantt.php by phpmd

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 '\App\Language' in method 'process'.
Open

            $viewer->assign('GANTT_TITLE', \App\Language::translate('LBL_GANTT_TITLE', 'Project'));
Severity: Minor
Found in modules/Project/views/Gantt.php by phpmd

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->assign('GANTT_TITLE', \App\Language::translate('LBL_GANTT_TITLE', 'Project'));
            $viewer->view('gantt/GanttContents.tpl', $moduleName);
        }
Severity: Minor
Found in modules/Project/views/Gantt.php by phpmd

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 'CustomView_Record_Model' in method 'preProcess'.
Open

        $viewer->assign('CUSTOM_VIEWS', CustomView_Record_Model::getAll($moduleName));
Severity: Minor
Found in modules/Project/views/Gantt.php by phpmd

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 'preProcess'.
Open

        $viewer->assign('MODULE_MODEL', Vtiger_Module_Model::getInstance($moduleName));
Severity: Minor
Found in modules/Project/views/Gantt.php by phpmd

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

Reference to undeclared property \Project_Gantt_View->viewName
Open

        $this->viewName = App\CustomView::getInstance($moduleName)->getViewId();
Severity: Minor
Found in modules/Project/views/Gantt.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('MODULE_NAME', $moduleName);
Severity: Critical
Found in modules/Project/views/Gantt.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

            $viewer->assign('GANTT_TITLE', \App\Language::translate('LBL_GANTT_TITLE', 'Project'));
Severity: Critical
Found in modules/Project/views/Gantt.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

            $viewer->assign('GANTT_TITLE', \App\Language::translate('LBL_GANTT_TITLE_ALL_PROJECTS', 'Project'));
Severity: Critical
Found in modules/Project/views/Gantt.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('CUSTOM_VIEWS', CustomView_Record_Model::getAll($moduleName));
Severity: Critical
Found in modules/Project/views/Gantt.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('VIEWID', $this->viewName);
Severity: Critical
Found in modules/Project/views/Gantt.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('MODULE_MODEL', Vtiger_Module_Model::getInstance($moduleName));
Severity: Critical
Found in modules/Project/views/Gantt.php by phan

Reference to undeclared property \Project_Gantt_View->viewName
Open

        $viewer->assign('VIEWID', $this->viewName);
Severity: Minor
Found in modules/Project/views/Gantt.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('PROJECTID', 0);
Severity: Critical
Found in modules/Project/views/Gantt.php by phan

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

class Project_Gantt_View extends Vtiger_Index_View

The class Project_Gantt_View is not named in CamelCase.
Open

class Project_Gantt_View extends Vtiger_Index_View
{
    /** {@inheritdoc} */
    public function preProcess(App\Request $request, $display = true)
    {
Severity: Minor
Found in modules/Project/views/Gantt.php by phpmd

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

        parent::postProcess($request);

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

        }

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

            '~libraries/chartjs-plugin-datalabels/dist/chartjs-plugin-datalabels.js',

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

            'modules.Project.resources.Gantt',

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

    /** {@inheritdoc} */

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

        parent::preProcess($request, false);

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

            $this->preProcessDisplay($request);

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

    /** {@inheritdoc} */

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

    public function postProcess(App\Request $request, $display = true)

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

        $jsFileNames = [

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

            '~libraries/gantt-elastic/dist/bundle.js',

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 = $this->getViewer($request);

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

            $viewer->assign('GANTT_TITLE', \App\Language::translate('LBL_GANTT_TITLE', 'Project'));

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

            $viewer->view('gantt/GanttContents.tpl', $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

        $moduleName = $request->getModule();

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

    public function preProcessTplName(App\Request $request)

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

        $viewer->view('EmptyPostProcess.tpl', $request->getModule());

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

            $viewer->assign('GANTT_TITLE', \App\Language::translate('LBL_GANTT_TITLE_ALL_PROJECTS', 'Project'));

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

        return array_merge(parent::getFooterScripts($request), $this->checkAndConvertJsScripts($jsFileNames));

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

    public function preProcess(App\Request $request, $display = true)

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

        $this->viewName = App\CustomView::getInstance($moduleName)->getViewId();

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

        if ($display) {

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 ($request->has('view') && 'Gantt' === $request->getByType('view', 2)) {

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('MODULE_MODEL', Vtiger_Module_Model::getInstance($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

        $viewer->assign('CUSTOM_VIEWS', CustomView_Record_Model::getAll($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

    /** {@inheritdoc} */

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

    public function getFooterScripts(App\Request $request)

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

        return 'gantt/GanttViewPreProcess.tpl';

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

    {

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

    /** {@inheritdoc} */

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

    {

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

            'modules.Project.resources.GanttController',

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

    /** {@inheritdoc} */

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

        $viewer->assign('PROJECTID', 0);

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->view('gantt/GanttAll.tpl', $moduleName);

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

        $viewer->assign('VIEWID', $this->viewName);

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

            '~libraries/chart.js/dist/Chart.js',

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

class Project_Gantt_View extends Vtiger_Index_View

There are no issues that match your filters.

Category
Status