YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/widgets/InventoryBlock.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using static access to class '\App\Module' in method 'getWidget'.
Open

            $this->Config['data']['relatedmodule'] = \App\Module::getModuleId($this->Module);

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 method isInventory on non-class type false
Open

        return parent::isPermitted() && $this->moduleModel->isInventory();
Severity: Critical
Found in modules/Vtiger/widgets/InventoryBlock.php by phan

Reference to undeclared property \Vtiger_InventoryBlock_Widget->Data
Open

        return "module={$this->Module}&view=Detail&fromModule={$this->Module}&record={$this->Record}&mode=showInventoryEntries&page=1&limit=" . $this->Data['limit'] . '&fields=' . implode(',', $this->Data['relatedfields']);

Suspicious type false of a variable or expression used to build a string. (Expected type to be able to cast to a string)
Open

        return "module={$this->Module}&view=Detail&fromModule={$this->Module}&record={$this->Record}&mode=showInventoryEntries&page=1&limit=" . $this->Data['limit'] . '&fields=' . implode(',', $this->Data['relatedfields']);

Argument 1 (moduleName) is false but \App\Module::getModuleId() takes string defined at /code/app/Module.php:117
Open

            $this->Config['data']['relatedmodule'] = \App\Module::getModuleId($this->Module);

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

class Vtiger_InventoryBlock_Widget extends Vtiger_Basic_Widget

The class Vtiger_InventoryBlock_Widget is not named in CamelCase.
Open

class Vtiger_InventoryBlock_Widget extends Vtiger_Basic_Widget
{
    /** {@inheritdoc} */
    public function isPermitted(): bool
    {

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 parent::isPermitted() && $this->moduleModel->isInventory();

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

    public function getUrl()

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 (!isset($this->Config['data']['relatedmodule'])) {

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

    {

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

     * Get URL.

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 'InventoryBlockConfig';

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

    public function getWidget()

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 isPermitted(): bool

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

        return "module={$this->Module}&view=Detail&fromModule={$this->Module}&record={$this->Record}&mode=showInventoryEntries&page=1&limit=" . $this->Data['limit'] . '&fields=' . implode(',', $this->Data['relatedfields']);

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

            $this->Config['data']['relatedmodule'] = \App\Module::getModuleId($this->Module);

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 $this->Config;

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

    }

Line exceeds 120 characters; contains 223 characters
Open

        return "module={$this->Module}&view=Detail&fromModule={$this->Module}&record={$this->Record}&mode=showInventoryEntries&page=1&limit=" . $this->Data['limit'] . '&fields=' . implode(',', $this->Data['relatedfields']);

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

        $this->Config['url'] = $this->getUrl();

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

    public function getConfigTplName()

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

class Vtiger_InventoryBlock_Widget extends Vtiger_Basic_Widget

There are no issues that match your filters.

Category
Status