YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

            throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

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

            throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

        $viewer->assign('TREE', \App\Json::encode($treeCategoryModel->getTreeData()));

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

        $treeCategoryModel = Vtiger_TreeCategoryModal_Model::getInstance($moduleModel);

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\Privilege' in method 'checkPermission'.
Open

        if (!\App\Privilege::isPermitted($request->getByType('src_module', 2), 'DetailView', $recordId)) {

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

        $moduleModel = Vtiger_Module_Model::getInstance($moduleName);

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

        $viewer->assign('USER_MODEL', 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 unused parameters such as '$request'.
Open

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('TREE', \App\Json::encode($treeCategoryModel->getTreeData()));
Severity: Critical
Found in modules/Vtiger/views/TreeCategoryModal.php by phan

Reference to undeclared property \Vtiger_TreeCategoryModal_View->relationType
Open

        $this->relationType = $treeCategoryModel->getRelationType();

Call to undeclared method \Vtiger_Viewer::assign
Open

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('SRC_MODULE', $srcModule);
Severity: Critical
Found in modules/Vtiger/views/TreeCategoryModal.php by phan

Call to undeclared method \Vtiger_TreeView_Model::getRelationType
Open

        $this->relationType = $treeCategoryModel->getRelationType();
Severity: Critical
Found in modules/Vtiger/views/TreeCategoryModal.php by phan

Call to undeclared method \Vtiger_TreeView_Model::getTreeData
Open

        $viewer->assign('TREE', \App\Json::encode($treeCategoryModel->getTreeData()));
Severity: Critical
Found in modules/Vtiger/views/TreeCategoryModal.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('RELATION_TYPE', $this->relationType);
Severity: Critical
Found in modules/Vtiger/views/TreeCategoryModal.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
Severity: Critical
Found in modules/Vtiger/views/TreeCategoryModal.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('TEMPLATE', $treeCategoryModel->getTemplate());
Severity: Critical
Found in modules/Vtiger/views/TreeCategoryModal.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('SRC_RECORD', $srcRecord);
Severity: Critical
Found in modules/Vtiger/views/TreeCategoryModal.php by phan

Reference to undeclared property \Vtiger_TreeCategoryModal_View->relationType
Open

        $viewer->assign('RELATION_TYPE', $this->relationType);

Reference to undeclared property \Vtiger_TreeCategoryModal_View->relationType
Open

        if (1 == $this->relationType) {

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

class Vtiger_TreeCategoryModal_View extends Vtiger_BasicModal_View

The class Vtiger_TreeCategoryModal_View is not named in CamelCase.
Open

class Vtiger_TreeCategoryModal_View extends Vtiger_BasicModal_View
{
    public function checkPermission(App\Request $request)
    {
        $recordId = $request->getInteger('src_record');

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

        return 'modal-lg';

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

        $viewer->assign('TREE', \App\Json::encode($treeCategoryModel->getTreeData()));

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

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

     * @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

    public function process(App\Request $request)

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

            $scripts[] = '~layouts/resources/libraries/jstree.edit.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

            throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

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

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

        return array_merge($this->checkAndConvertJsScripts($scripts), parent::getModalScripts($request));

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

    public function getModalCss(App\Request $request)

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

    public function checkPermission(App\Request $request)

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

        if (!\App\Privilege::isPermitted($request->getByType('src_module', 2), 'DetailView', $recordId)) {

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

     * Function to get size modal window.

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

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

        $viewer = $this->getViewer($request);

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

        $treeCategoryModel->set('srcModule', $srcModule);

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

        $viewer->assign('SRC_MODULE', $srcModule);

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

            throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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('USER_MODEL', Users_Record_Model::getCurrentUserModel());

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

        $this->postProcess($request);

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

        if (1 == $this->relationType) {

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 array_merge($this->checkAndConvertCssStyles([

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

        $this->preProcess($request);

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

        $this->relationType = $treeCategoryModel->getRelationType();

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

        $scripts = [

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

        $treeCategoryModel->set('srcRecord', $srcRecord);

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

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

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

        $scripts[] = 'modules.Vtiger.resources.TreeCategoryModal';

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 (!$recordId) {

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

        $viewer->assign('SRC_RECORD', $srcRecord);

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

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

        ]), parent::getModalCss($request));

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

        $recordId = $request->getInteger('src_record');

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

        $srcRecord = $request->getInteger('src_record');

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

        $viewer->assign('RELATION_TYPE', $this->relationType);

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

        $treeCategoryModel = Vtiger_TreeCategoryModal_Model::getInstance($moduleModel);

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

        $viewer->assign('TEMPLATE', $treeCategoryModel->getTemplate());

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

        $moduleModel = Vtiger_Module_Model::getInstance($moduleName);

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

class Vtiger_TreeCategoryModal_View extends Vtiger_BasicModal_View

There are no issues that match your filters.

Category
Status