YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

            throw new \App\Exceptions\NoPermitted('ERR_PERMISSION_DENIED', 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 'Users_Privileges_Model' in method 'checkPermission'.
Open

        $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

        $this->advancedConditions = \App\Condition::validAdvancedConditions($request->getArray('advancedConditions'));

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

Argument 1 (mixed) is string but \Users_Privileges_Model::hasModulePermission() takes int defined at /code/modules/Users/models/Privileges.php:101
Open

        if (!$currentUserPrivilegesModel->hasModulePermission($request->getModule()) || !$currentUserPrivilegesModel->hasModuleActionPermission($request->getModule(), 'CustomViewAdvCond')) {

Call to undeclared method \Vtiger_CustomViewAdvCondModal_View::getViewer
Open

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

Class extends undeclared class \App\Controller\Modal
Open

class Vtiger_CustomViewAdvCondModal_View extends \App\Controller\Modal

Avoid excessively long variable names like $currentUserPrivilegesModel. Keep variable name length under 20.
Open

        $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

class Vtiger_CustomViewAdvCondModal_View extends \App\Controller\Modal

The class Vtiger_CustomViewAdvCondModal_View is not named in CamelCase.
Open

class Vtiger_CustomViewAdvCondModal_View extends \App\Controller\Modal
{
    /** {@inheritdoc} */
    protected $pageTitle = 'LBL_CUSTOM_VIEW_ADV_COND';

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

    public $modalIcon = 'yfi-advenced-custom-view-conditions';

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

    }

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

    /** @var array Advanced conditions */

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

    public function process(App\Request $request): void

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

        $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

Line exceeds 120 characters; contains 190 characters
Open

        if (!$currentUserPrivilegesModel->hasModulePermission($request->getModule()) || !$currentUserPrivilegesModel->hasModuleActionPermission($request->getModule(), 'CustomViewAdvCond')) {

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

        if (!$currentUserPrivilegesModel->hasModulePermission($request->getModule()) || !$currentUserPrivilegesModel->hasModuleActionPermission($request->getModule(), 'CustomViewAdvCond')) {

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

    protected $advancedConditions;

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

        $viewer->assign('RELATIONS', Vtiger_Module_Model::getInstance($moduleName)->getRelations());

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 $successBtn = 'LBL_SAVE';

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->advancedConditions = \App\Condition::validAdvancedConditions($request->getArray('advancedConditions'));

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

        $viewer->assign('ADVANCED_CONDITIONS', $this->advancedConditions);

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

    protected $pageTitle = 'LBL_CUSTOM_VIEW_ADV_COND';

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

            throw new \App\Exceptions\NoPermitted('ERR_PERMISSION_DENIED', 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->view('CustomView/AdvCondModal.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

        $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

    public function checkPermission(App\Request $request)

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

    /** {@inheritdoc} */

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

class Vtiger_CustomViewAdvCondModal_View extends \App\Controller\Modal

There are no issues that match your filters.

Category
Status