YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '28', 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 '31', 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\Privilege' in method 'checkPermission'.
Open

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

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

        $detailModel = Vtiger_DetailView_Model::getInstance($moduleName, $request->getInteger('record'));

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

        $handlerClass = Vtiger_Loader::getComponentClassName('View', 'Detail', $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

Define a constant instead of duplicating this literal "record" 3 times.
Open

        if ($request->isEmpty('record')) {

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

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('RECORD', $recordModel);
Severity: Critical
Found in modules/Vtiger/views/WidgetFullscreen.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('TITLE', $title);
Severity: Critical
Found in modules/Vtiger/views/WidgetFullscreen.php by phan

Call to method getInstance from undeclared class \Vtiger_DetailView_Model
Open

        $detailModel = Vtiger_DetailView_Model::getInstance($moduleName, $request->getInteger('record'));
Severity: Critical
Found in modules/Vtiger/views/WidgetFullscreen.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('CONTENT', $content);
Severity: Critical
Found in modules/Vtiger/views/WidgetFullscreen.php by phan

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

class Vtiger_WidgetFullscreen_View extends Vtiger_BasicModal_View

The class Vtiger_WidgetFullscreen_View is not named in CamelCase.
Open

class Vtiger_WidgetFullscreen_View extends Vtiger_BasicModal_View
{
    /**
     * Checking permissions.
     *

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

        $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

     *

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

    {

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

        $handlerClass = Vtiger_Loader::getComponentClassName('View', 'Detail', $moduleName);

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

        $viewer->assign('CONTENT', $content);

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

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

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

        $detailModel->getWidgets();

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

            $content = $detailView->{$mode}($request);

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

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

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

    /**

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

        $recordModel = $detailModel->getRecord();

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

        $title = '';

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

        if ($request->isEmpty('record')) {

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

     * @throws \App\Exceptions\NoPermittedToRecord

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

        return 'modal-blg';

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

        $detailModel = Vtiger_DetailView_Model::getInstance($moduleName, $request->getInteger('record'));

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

        $detailView = new $handlerClass();

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

        $mode = $request->getMode();

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

        $viewer->assign('TITLE', $title);

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

        $this->preProcess($request);

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

        $detailView->record = $detailModel;

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

        $request->set('isFullscreen', 'true');

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

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

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

        }

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

        if ($detailView->isMethodExposed($mode)) {

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

    public function process(App\Request $request)

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

        $request->set('limit', 30);

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

     * Checking permissions.

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

        }

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

class Vtiger_WidgetFullscreen_View extends Vtiger_BasicModal_View

There are no issues that match your filters.

Category
Status