YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

            throw new \App\Exceptions\NoPermitted('LBL_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 assigning values to variables in if clauses and the like (line '36', column '125').
Open

    public function checkPermission(App\Request $request)
    {
        $this->recordModel = $request->isEmpty('record', true) ? null : Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());
        if (!$this->recordModel || !$this->recordModel->isPermitted('AutoAssignRecord') || !$this->recordModel->isEditable() || !($this->autoAssignModel = \App\AutoAssign::getAutoAssignForRecord($this->recordModel, \App\AutoAssign::MODE_MANUAL))) {
            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

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

Avoid using static access to class 'Vtiger_Record_Model' in method 'checkPermission'.
Open

        $this->recordModel = $request->isEmpty('record', true) ? null : Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());

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

        if (!$this->recordModel || !$this->recordModel->isPermitted('AutoAssignRecord') || !$this->recordModel->isEditable() || !($this->autoAssignModel = \App\AutoAssign::getAutoAssignForRecord($this->recordModel, \App\AutoAssign::MODE_MANUAL))) {

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

Call to undeclared method \Vtiger_AutoAssignRecord_View::checkAndConvertJsScripts
Open

        return array_merge($this->checkAndConvertJsScripts([
Severity: Critical
Found in modules/Vtiger/views/AutoAssignRecord.php by phan

Reference to undeclared class \App\Controller\Modal
Open

        ]), parent::getModalScripts($request));
Severity: Critical
Found in modules/Vtiger/views/AutoAssignRecord.php by phan

Class extends undeclared class \App\Controller\Modal
Open

class Vtiger_AutoAssignRecord_View extends \App\Controller\Modal
Severity: Critical
Found in modules/Vtiger/views/AutoAssignRecord.php by phan

Reference to undeclared class \App\Controller\Modal
Open

        ]), parent::getModalCss($request));
Severity: Critical
Found in modules/Vtiger/views/AutoAssignRecord.php by phan

Call to undeclared method \Vtiger_AutoAssignRecord_View::checkAndConvertCssStyles
Open

        return array_merge($this->checkAndConvertCssStyles([
Severity: Critical
Found in modules/Vtiger/views/AutoAssignRecord.php by phan

Call to undeclared method \Vtiger_AutoAssignRecord_View::getViewer
Open

        $viewer = $this->getViewer($request);
Severity: Critical
Found in modules/Vtiger/views/AutoAssignRecord.php by phan

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

class Vtiger_AutoAssignRecord_View extends \App\Controller\Modal

The class Vtiger_AutoAssignRecord_View is not named in CamelCase.
Open

class Vtiger_AutoAssignRecord_View extends \App\Controller\Modal
{
    /** {@inheritdoc} */
    public $modalSize = 'modal-xl';

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

        return array_merge($this->checkAndConvertCssStyles([

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

    /** @var \App\AutoAssign Record model. */

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

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

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

    }

Line exceeds 120 characters; contains 248 characters
Open

        if (!$this->recordModel || !$this->recordModel->isPermitted('AutoAssignRecord') || !$this->recordModel->isEditable() || !($this->autoAssignModel = \App\AutoAssign::getAutoAssignForRecord($this->recordModel, \App\AutoAssign::MODE_MANUAL))) {

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

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

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

    public $modalSize = 'modal-xl';

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

    /** @var \Vtiger_Record_Model Record model. */

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

    public $showFooter = false;

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

     * Process.

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 checkPermission(App\Request $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

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

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

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

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

    /** {@inheritdoc} */

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

    public $modalIcon = 'yfi yfi-automatic-assignment';

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 (!$this->recordModel || !$this->recordModel->isPermitted('AutoAssignRecord') || !$this->recordModel->isEditable() || !($this->autoAssignModel = \App\AutoAssign::getAutoAssignForRecord($this->recordModel, \App\AutoAssign::MODE_MANUAL))) {

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

    /** {@inheritdoc} */

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

        $viewer->assign('AUTO_ASSIGN_RECORD', $this->autoAssignModel);

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

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

Line exceeds 120 characters; contains 164 characters
Open

        $this->recordModel = $request->isEmpty('record', true) ? null : Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());

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

        return array_merge($this->checkAndConvertJsScripts([

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

    private $recordModel;

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->assign('CURRENT_OWNER', $this->recordModel->get('assigned_user_id'));

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

            '~libraries/datatables.net/js/jquery.dataTables.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

    public function getModalCss(App\Request $request)

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

    private $autoAssignModel;

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

        $this->recordModel = $request->isEmpty('record', true) ? null : Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $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

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

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

    public $pageTitle = 'BTN_ASSIGN_TO';

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

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

        $viewer->assign('RECORD', $this->recordModel);

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

class Vtiger_AutoAssignRecord_View extends \App\Controller\Modal

There are no issues that match your filters.

Category
Status