YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
C
79%

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

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
Severity: Minor
Found in modules/Vtiger/views/Index.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 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/Index.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 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/Index.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_Module_Model' in method 'preProcess'.
Open

            $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
Severity: Minor
Found in modules/Vtiger/views/Index.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

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

        if (!Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModulePermission($request->getModule())) {
Severity: Minor
Found in modules/Vtiger/views/Index.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

            $viewer->assign('QUICK_LINKS', $linkModels);
Severity: Critical
Found in modules/Vtiger/views/Index.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('CURRENT_VIEW', $request->getByType('view', 1));
Severity: Critical
Found in modules/Vtiger/views/Index.php by phan

Declaration of function getFooterScripts(\App\Request $request) : \Vtiger_JsScript_Model[] should be compatible with function getFooterScripts(\App\Request $request) : \App\Controller\View\Vtiger_JsScript_Model[] defined in /code/app/Controller/View/Page.php:70
Open

    public function getFooterScripts(App\Request $request)
Severity: Minor
Found in modules/Vtiger/views/Index.php by phan

Returning type \App\Controller\View\Vtiger_JsScript_Model[] but getFooterScripts() is declared to return \Vtiger_JsScript_Model[]
Open

        return array_merge(parent::getFooterScripts($request), $this->checkAndConvertJsScripts($jsFileNames));
Severity: Minor
Found in modules/Vtiger/views/Index.php by phan

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

class Vtiger_Index_View extends \App\Controller\View\Page

The class Vtiger_Index_View is not named in CamelCase.
Open

class Vtiger_Index_View extends \App\Controller\View\Page
{
    /** {@inheritdoc} */
    public function checkPermission(App\Request $request)
    {
Severity: Minor
Found in modules/Vtiger/views/Index.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

        }

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

            $viewer->assign('QUICK_LINKS', $linkModels);

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

        $this->getViewer($request)->view('IndexPostProcess.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

            'modules.Vtiger.resources.' . $view,

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

        if (!Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModulePermission($request->getModule())) {

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

        $this->getViewer($request)->view('Index.tpl', $request->getModule());

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

     *

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

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

        $viewer->assign('CURRENT_VIEW', $request->getByType('view', 1));

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

        return 'IndexViewPreProcess.tpl';

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

     */

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

            "modules.$moduleName.resources.$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

    {

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

        $view = $request->getByType('view', 1);

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

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

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

    protected function preProcessTplName(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

            'modules.Vtiger.resources.Vtiger',

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

        if ($display) {

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::postProcess($request, $display);

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

     * Function to get the list of Script models to be included.

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

    }

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

            $linkModels = $moduleModel->getSideBarLinks($linkParams);

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

    /** {@inheritdoc} */

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

        parent::preProcess($request, false);

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

            "modules.$moduleName.resources.$view",

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

            $this->preProcessDisplay($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 getFooterScripts(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

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

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

    /**

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

        $jsFileNames = [

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

            $linkParams = ['MODULE' => $moduleName, 'ACTION' => $request->getByType('view', 1)];

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

     * @return Vtiger_JsScript_Model[]

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 postProcess(App\Request $request, $display = true)

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

    {

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

class Vtiger_Index_View extends \App\Controller\View\Page

There are no issues that match your filters.

Category
Status