YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
F
40%

Avoid using static access to class 'Settings_Vtiger_MenuItem_Model' in method 'getSettingLinks'.
Open

        if ($menu = Settings_Vtiger_MenuItem_Model::getInstance('Mail View')) {
Severity: Minor
Found in modules/OSSMailView/models/Module.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

Avoid using static access to class '\App\Privilege' in method 'isPermitted'.
Open

        return $this->isActive() && \App\Privilege::isPermitted($this->getName(), $actionName);
Severity: Minor
Found in modules/OSSMailView/models/Module.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

Avoid using static access to class 'Vtiger_Theme' in method 'getSettingLinks'.
Open

        $layoutEditorImagePath = Vtiger_Theme::getImagePath('LayoutEditor.gif');
Severity: Minor
Found in modules/OSSMailView/models/Module.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

Avoid assigning values to variables in if clauses and the like (line '16', column '7').
Open

    public function getSettingLinks(): array
    {
        $settingsLinks = parent::getSettingLinks();
        $layoutEditorImagePath = Vtiger_Theme::getImagePath('LayoutEditor.gif');
        if ($menu = Settings_Vtiger_MenuItem_Model::getInstance('Mail View')) {
Severity: Minor
Found in modules/OSSMailView/models/Module.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid excessively long variable names like $layoutEditorImagePath. Keep variable name length under 20.
Open

        $layoutEditorImagePath = Vtiger_Theme::getImagePath('LayoutEditor.gif');
Severity: Minor
Found in modules/OSSMailView/models/Module.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

class OSSMailView_Module_Model extends Vtiger_Module_Model

The class OSSMailView_Module_Model is not named in CamelCase.
Open

class OSSMailView_Module_Model extends Vtiger_Module_Model
{
    /** {@inheritdoc} */
    public function getSettingLinks(): array
    {
Severity: Minor
Found in modules/OSSMailView/models/Module.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

Avoid variables with short names like $id. Configured minimum length is 3.
Open

    public function getPreviewViewUrl($id)
Severity: Minor
Found in modules/OSSMailView/models/Module.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

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

    public function getSettingLinks(): array

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

        return $settingsLinks;

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

    public function getPreviewViewUrl($id)

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

        return $this->isActive() && \App\Privilege::isPermitted($this->getName(), $actionName);

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

    {

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

    {

Line exceeds 120 characters; contains 156 characters
Open

                'linkurl' => 'index.php?module=OSSMailView&parent=Settings&view=index&block=' . $menu->get('blockid') . '&fieldid=' . $menu->get('fieldid'),

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

                'linkicon' => $layoutEditorImagePath,

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 'index.php?module=' . $this->get('name') . '&view=Preview&record=' . $id;

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

        return false;

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

        $layoutEditorImagePath = Vtiger_Theme::getImagePath('LayoutEditor.gif');

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

        if ($menu = Settings_Vtiger_MenuItem_Model::getInstance('Mail View')) {

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

        $settingsLinks = parent::getSettingLinks();

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

            return false;

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

                'linklabel' => 'LBL_MODULE_CONFIGURATION',

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

                'linkurl' => 'index.php?module=OSSMailView&parent=Settings&view=index&block=' . $menu->get('blockid') . '&fieldid=' . $menu->get('fieldid'),

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

    public function isPermitted($actionName)

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

                'linktype' => 'LISTVIEWSETTING',

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

        if ('EditView' === $actionName || 'CreateView' === $actionName) {

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

            $settingsLinks[] = [

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

    public function isQuickCreateSupported()

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

    }

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

class OSSMailView_Module_Model extends Vtiger_Module_Model

There are no issues that match your filters.

Category
Status