YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/views/TreeRecords.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '26', column '14').
Open

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
Severity: Minor
Found in modules/Vtiger/views/TreeRecords.php by phpmd

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

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/Vtiger/views/TreeRecords.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/Vtiger/views/TreeRecords.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 'Vtiger_ListView_Model' in method 'process'.
Open

        $listViewModel = Vtiger_ListView_Model::getInstance($moduleName, $filter);
Severity: Minor
Found in modules/Vtiger/views/TreeRecords.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 'getBreadcrumbTitle'.
Open

        return \App\Language::translate($treeViewModel->getName(), $moduleName);
Severity: Minor
Found in modules/Vtiger/views/TreeRecords.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_TreeView_Model' in method 'preProcess'.
Open

        $treeViewModel = Vtiger_TreeView_Model::getInstance($moduleName);
Severity: Minor
Found in modules/Vtiger/views/TreeRecords.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 'CustomView_Record_Model' in method 'postProcess'.
Open

        $viewer->assign('CUSTOM_VIEWS', CustomView_Record_Model::getAllByGroup($moduleName));
Severity: Minor
Found in modules/Vtiger/views/TreeRecords.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\Json' in method 'preProcess'.
Open

        $viewer->assign('TREE_LIST', \App\Json::encode($treeList));
Severity: Minor
Found in modules/Vtiger/views/TreeRecords.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_TreeView_Model' in method 'getBreadcrumbTitle'.
Open

        $treeViewModel = Vtiger_TreeView_Model::getInstance($moduleName);
Severity: Minor
Found in modules/Vtiger/views/TreeRecords.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_TreeView_Model' in method 'process'.
Open

        $treeViewModel = Vtiger_TreeView_Model::getInstance($moduleName);
Severity: Minor
Found in modules/Vtiger/views/TreeRecords.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 unused parameters such as '$display'.
Open

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

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('TREE_LIST', \App\Json::encode($treeList));
Severity: Critical
Found in modules/Vtiger/views/TreeRecords.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('ENTRIES', $listEntries);
Severity: Critical
Found in modules/Vtiger/views/TreeRecords.php by phan

Call to method addCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
Open

        $listViewModel->getQueryGenerator()->addCondition($field['fieldname'], implode('##', $branches), 'e');
Severity: Critical
Found in modules/Vtiger/views/TreeRecords.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('HEADERS', $listHeaders);
Severity: Critical
Found in modules/Vtiger/views/TreeRecords.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('MODULE', $moduleName);
Severity: Critical
Found in modules/Vtiger/views/TreeRecords.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('VIEWID', $filter);
Severity: Critical
Found in modules/Vtiger/views/TreeRecords.php by phan

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

class Vtiger_TreeRecords_View extends Vtiger_Index_View

The class Vtiger_TreeRecords_View is not named in CamelCase.
Open

class Vtiger_TreeRecords_View extends Vtiger_Index_View
{
    /**
     * Function to check permission.
     *
Severity: Minor
Found in modules/Vtiger/views/TreeRecords.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

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

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

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

        }

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

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

     * Function to check permission.

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

        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

    {

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

        $treeViewModel = Vtiger_TreeView_Model::getInstance($moduleName);

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

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

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

    public function getBreadcrumbTitle(App\Request $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

    {

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

        $treeList = $treeViewModel->getTreeList();

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

    /**

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

     *

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

        if (!Vtiger_TreeView_Model::getInstance($request->getModule())->isActive()) {

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

        }

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

     * @throws \App\Exceptions\NoPermitted

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

        $viewer->assign('CUSTOM_VIEWS', CustomView_Record_Model::getAllByGroup($moduleName));

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

            '~libraries/datatables.net-responsive-bs4/js/responsive.bootstrap4.js'

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

        $viewer->view('TreeRecordsPreProcess.tpl', $moduleName);

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('HEADERS', $listHeaders);

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

            '~libraries/datatables.net-bs4/css/dataTables.bootstrap4.css',

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

        $filter = $request->has('filter') ? $request->getByType('filter', 'Alnum') : \App\CustomView::getInstance($moduleName)->getViewId();

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

        if (0 === \count($listEntries)) {

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

        $viewer->assign('ENTRIES', $listEntries);

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

    {

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

            '~layouts/resources/libraries/jstree.category.js',

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

        ]));

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

    protected function postProcessDisplay(App\Request $request)

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

            '~layouts/resources/libraries/jstree.checkbox.js',

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

            '~libraries/datatables.net-bs4/js/dataTables.bootstrap4.js',

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

     */

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

        $treeViewModel = Vtiger_TreeView_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

            $this->postProcessDisplay($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

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

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

    }

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

        $viewer->assign('TREE_LIST', \App\Json::encode($treeList));

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

        $listViewModel = Vtiger_ListView_Model::getInstance($moduleName, $filter);

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

        ]));

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

        $listHeaders = $listViewModel->getListViewHeaders();

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

    public function checkPermission(App\Request $request)

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

        return \App\Language::translate($treeViewModel->getName(), $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

            return;

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

            '~libraries/datatables.net-responsive-bs4/css/responsive.bootstrap4.css'

Line exceeds 120 characters; contains 140 characters
Open

        $filter = $request->has('filter') ? $request->getByType('filter', 'Alnum') : \App\CustomView::getInstance($moduleName)->getViewId();

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

        $viewer = $this->getViewer($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

        $viewer->assign('VIEWID', $filter);

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

        if ($request->isEmpty('branches', true)) {

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

        $treeViewModel = Vtiger_TreeView_Model::getInstance($moduleName);

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

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

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

    public function getHeaderCss(App\Request $request)

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

            '~libraries/datatables.net-responsive/js/dataTables.responsive.js',

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

    }

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

        $field = $treeViewModel->getTreeField();

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

        $listEntries = $listViewModel->getAllEntries();

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

            '~libraries/jstree/dist/jstree.js',

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

        return array_merge(parent::getHeaderCss($request), $this->checkAndConvertCssStyles([

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

            '~libraries/jstree-bootstrap-theme/dist/themes/proton/style.css',

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

        $listViewModel->getQueryGenerator()->addCondition($field['fieldname'], implode('##', $branches), 'e');

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

            '~libraries/datatables.net/js/jquery.dataTables.js',

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

        }

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

        $branches = $request->getArray('branches', 'Text');

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

        $viewer->view('TreeRecords.tpl', $moduleName);

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

    {

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

class Vtiger_TreeRecords_View extends Vtiger_Index_View

There are no issues that match your filters.

Category
Status