YetiForceCompany/YetiForceCRM

View on GitHub
modules/OpenStreetMap/models/Module.php

Summary

Maintainability
A
0 mins
Test Coverage
B
87%

Avoid using static access to class '\App\Config' in method 'isAllowModules'.
Open

        return \in_array($moduleName, \App\Config::module($this->getName(), 'mapModules', []));

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 'getAllowedModules'.
Open

            if (!\App\Privilege::isPermitted($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

Avoid using static access to class '\App\Config' in method 'getAllowedModules'.
Open

        $allAllowedModules = \App\Config::module($this->getName(), 'mapModules', []);

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

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

class OpenStreetMap_Module_Model extends Vtiger_Module_Model

The class OpenStreetMap_Module_Model is not named in CamelCase.
Open

class OpenStreetMap_Module_Model extends Vtiger_Module_Model
{
    /** @var string Table name of coordinates for records */
    const COORDINATES_TABLE_NAME = 'u_#__openstreetmap';

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

    /** @var string Table name of coordinates for records */

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

     * @param string $moduleName

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

    const COORDINATES_TABLE_NAME = 'u_#__openstreetmap';

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 \in_array($moduleName, \App\Config::module($this->getName(), 'mapModules', []));

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

     * Check if module is allowed.

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

        }

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

            if (!\App\Privilege::isPermitted($moduleName)) {

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

                unset($allAllowedModules[$key]);

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

     * @return bool

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

     * Function to get allow modules with checking permissions.

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

        return $allAllowedModules;

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 isAllowModules($moduleName)

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

        foreach ($allAllowedModules as $key => $moduleName) {

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

    public function getAllowedModules(): array

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

        $allAllowedModules = \App\Config::module($this->getName(), 'mapModules', []);

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 string[]

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

     *

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

     */

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

class OpenStreetMap_Module_Model extends Vtiger_Module_Model

There are no issues that match your filters.

Category
Status