mambax7/songlist

View on GitHub
class/Utf8map.php

Summary

Maintainability
A
0 mins
Test Coverage

The method getForm has a boolean flag argument $as_array, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getForm($as_array = false)
Severity: Minor
Found in class/Utf8map.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 '\XoopsModules\Songlist\Form\FormController' in method 'getForm'.
Open

        return FormController::getFormUtf8map($this, $as_array);
Severity: Minor
Found in class/Utf8map.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 unused parameters such as '$fid'.
Open

    public function __construct($fid = null)
Severity: Minor
Found in class/Utf8map.php by phpmd

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

The parameter $as_array is not named in camelCase.
Open

    public function getForm($as_array = false)
    {
        return FormController::getFormUtf8map($this, $as_array);
    }
Severity: Minor
Found in class/Utf8map.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

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

    public $to;
Severity: Minor
Found in class/Utf8map.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

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 17 and the first side effect is on line 7.
Open

<?php declare(strict_types=1);
Severity: Minor
Found in class/Utf8map.php by phpcodesniffer

There must be a single space after the USE keyword
Open

use  XoopsModules\Songlist\Form\FormController;
Severity: Minor
Found in class/Utf8map.php by phpcodesniffer

The variable $as_array is not named in camelCase.
Open

    public function getForm($as_array = false)
    {
        return FormController::getFormUtf8map($this, $as_array);
    }
Severity: Minor
Found in class/Utf8map.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

There are no issues that match your filters.

Category
Status