lib/Ajde/Lang/Proxy/Model.php

Summary

Maintainability
A
0 mins
Test Coverage

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

    protected function _load($sql, $values, $populate = true)
Severity: Minor
Found in lib/Ajde/Lang/Proxy/Model.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

Missing class import via use statement (line '118', column '36').
Open

        $collection->addFilter(new Ajde_Filter_Where($this->languageRootField, Ajde_Filter::FILTER_EQUALS,
Severity: Minor
Found in lib/Ajde/Lang/Proxy/Model.php by phpmd

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 assigning values to variables in if clauses and the like (line '130', column '17').
Open

    protected function _load($sql, $values, $populate = true)
    {
        $return = parent::_load($sql, $values, $populate);
        if (Ajde_Lang::getInstance()->autoTranslateModels() && $return) {
            // get translation
Severity: Minor
Found in lib/Ajde/Lang/Proxy/Model.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 using static access to class 'Ajde_Lang' in method '_load'.
Open

            $lang = Ajde_Lang::getInstance();
Severity: Minor
Found in lib/Ajde/Lang/Proxy/Model.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

The class Ajde_Lang_Proxy_Model is not named in CamelCase.
Open

abstract class Ajde_Lang_Proxy_Model extends Ajde_Model
{
    protected $languageField = 'lang';
    protected $languageRootField = 'lang_root';

Severity: Minor
Found in lib/Ajde/Lang/Proxy/Model.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 $pk. Configured minimum length is 3.
Open

        $pk = $this->getPK();
Severity: Minor
Found in lib/Ajde/Lang/Proxy/Model.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

The method _load is not named in camelCase.
Open

    protected function _load($sql, $values, $populate = true)
    {
        $return = parent::_load($sql, $values, $populate);
        if (Ajde_Lang::getInstance()->autoTranslateModels() && $return) {
            // get translation
Severity: Minor
Found in lib/Ajde/Lang/Proxy/Model.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status