YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '34', 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 using static access to class '\App\RecordCollector' in method 'preProcessAjax'.
Open

        $this->recordCollector = \App\RecordCollector::getInstance($request->getByType('collectorType', 'ClassName'), $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\Privilege' in method 'checkPermission'.
Open

        if (!\App\Privilege::isPermitted($request->getModule(), 'EditView')) {

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->view('Modals/RecordCollector.tpl', $request->getModule());
        }

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

        $this->pageTitle = \App\Language::translate($this->recordCollector->label, 'Other.RecordCollector');

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 class \App\Controller\Modal
Open

            parent::preProcessAjax($request);
Severity: Critical
Found in modules/Vtiger/views/RecordCollector.php by phan

Reference to instance property label from undeclared class \App\RecordCollectors\Base
Open

        $this->pageTitle = \App\Language::translate($this->recordCollector->label, 'Other.RecordCollector');

Reference to instance property icon from undeclared class \App\RecordCollectors\Base
Open

        $this->modalIcon = $this->recordCollector->icon;

Call to method search from undeclared class \App\RecordCollectors\Base (Did you mean class \App\Base or class \App\Cache\Base or class \App\Cli\Base or class \App\Controller\Base or class \App\Controller\View\Base or class \App\Db\Importers\Base or class \Tests\Base)
Open

            $viewer->assign('SEARCH_DATA', $this->recordCollector->search());
Severity: Critical
Found in modules/Vtiger/views/RecordCollector.php by phan

Call to undeclared method \Vtiger_RecordCollector_View::getViewer
Open

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

Property \Vtiger_RecordCollector_View->recordCollector has undeclared type \App\RecordCollectors\Base (Did you mean class \App\Base or class \App\Cache\Base or class \App\Cli\Base or class \App\Controller\Base or class \App\Controller\View\Base or class \App\Db\Importers\Base or class \Tests\Base)
Open

    private $recordCollector;

Reference to undeclared property \Vtiger_RecordCollector_View->modalIcon
Open

        $this->modalIcon = $this->recordCollector->icon;

Class extends undeclared class \App\Controller\Modal
Open

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

Reference to undeclared property \Vtiger_RecordCollector_View->pageTitle
Open

        $this->pageTitle = \App\Language::translate($this->recordCollector->label, 'Other.RecordCollector');

Call to method setRequest from undeclared class \App\RecordCollectors\Base (Did you mean class \App\Base or class \App\Cache\Base or class \App\Cli\Base or class \App\Controller\Base or class \App\Controller\View\Base or class \App\Db\Importers\Base or class \Tests\Base)
Open

        $this->recordCollector->setRequest($request);
Severity: Critical
Found in modules/Vtiger/views/RecordCollector.php by phan

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

class Vtiger_RecordCollector_View extends \App\Controller\Modal

The class Vtiger_RecordCollector_View is not named in CamelCase.
Open

class Vtiger_RecordCollector_View extends \App\Controller\Modal
{
    /** {@inheritdoc} */
    public $showFooter = false;

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 $modalSize = 'c-modal-xxl';

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

        $this->modalIcon = $this->recordCollector->icon;

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

        $viewer->assign('RECORD_ID', $request->getInteger('record'));

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

        $this->recordCollector = \App\RecordCollector::getInstance($request->getByType('collectorType', 'ClassName'), $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

        if ('search' === $request->getMode()) {

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

        $this->pageTitle = \App\Language::translate($this->recordCollector->label, 'Other.RecordCollector');

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

        if (!$request->getMode()) {

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('SEARCH_DATA', $this->recordCollector->search());

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

    }

Line exceeds 120 characters; contains 141 characters
Open

        $this->recordCollector = \App\RecordCollector::getInstance($request->getByType('collectorType', 'ClassName'), $request->getModule());

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

    /** {@inheritdoc} */

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->view('Modals/RecordCollector.tpl', $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

        $viewer->assign('RECORD_COLLECTOR', $this->recordCollector);

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

        $this->recordCollector->setRequest($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

    public $modalId = 'record-collector-modal';

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

    private $recordCollector;

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

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

        } else {

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

    /** @var \App\RecordCollectors\Base Record collector instance. */

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

        }

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

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

        $viewer->assign('COLLECTOR_NAME', $request->getByType('collectorType', 'ClassName'));

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

        if (!\App\Privilege::isPermitted($request->getModule(), 'EditView')) {

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

            $viewer->view('Modals/RecordCollectorSearch.tpl', $request->getModule());

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

class Vtiger_RecordCollector_View extends \App\Controller\Modal

There are no issues that match your filters.

Category
Status