Asymptix/Framework

View on GitHub

Showing 720 of 720 total issues

Avoid using static access to class 'Asymptix\db\DBCore' in method 'saveRemovementFlag'.
Open

        return DBCore::doUpdateQuery(
            "UPDATE " . static::TABLE_NAME . "
                SET removed = ?,
                    update_time = ?,
                    update_user_id = ?
Severity: Minor
Found in framework/db/DBTimedObject.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 method localize uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $lValue = "";
                }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using static access to class '\Asymptix\web\Request' in method 'validateNotEmpty'.
Open

        $fieldValue = Request::getFieldValue($fieldName);

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 '\Asymptix\core\Errors' in method 'validateNotEmpty'.
Open

                    Errors::saveErrorFor($fieldName, \__ERRORS::EMPTY_FIELD);

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 method open uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            throw new POPServerException(
                "Unable to Connect to " . $host . ". Network Problems could be responsible.", 2
            );
        }
Severity: Minor
Found in framework/mail/POP.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using static access to class '\Asymptix\core\OutputStream' in method 'log'.
Open

                OutputStream::msg($msgType, $message, $format, $time);
Severity: Minor
Found in framework/tools/logging/Logger.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 method css uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $this->style[$propertyName] = $propertyValue;
            }
Severity: Minor
Found in framework/ui/UIComponent.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method setCurrentPage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $this->currentPage = $currentPage;
            }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using static access to class 'Asymptix\db\DBCore' in method 'max'.
Open

        return DBCore::selectSingleValue($query);
Severity: Minor
Found in framework/db/DBSelector.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 method getValueByComplexName uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else { // Simple key is provided
                if (isset($array[$complexName])) {
                    return $array[$complexName];
                } else {
                    throw new \Exception("Invalid simple key");
Severity: Minor
Found in framework/helpers/Naming.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method getValueByComplexName uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        throw new \Exception("Invalid complex key");
                    }
Severity: Minor
Found in framework/helpers/Naming.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method setValueWithComplexName uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else { // last element
                        $array[$key] = $value;
                    }
Severity: Minor
Found in framework/helpers/Naming.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method setValueWithComplexName uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            if (!is_array($array[$key])) { // detect if current value is array because not last element
                                if ($rewrite) {
                                    $array[$key] = [];
                                } else {
Severity: Minor
Found in framework/helpers/Naming.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid unused local variables such as '$quitresponse'.
Open

        $quitresponse = fgets($this->connection, 1024);
Severity: Minor
Found in framework/mail/POP.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

The method lowerCaseFirst uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $firstLetter = mb_substr(mb_strtoupper($str), 0, 1);

            return ($firstLetter . mb_substr($str, 1));
        }
Severity: Minor
Found in framework/helpers/StringHelper.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using static access to class '\Asymptix\core\OutputStream' in method 'close'.
Open

                OutputStream::close();
Severity: Minor
Found in framework/tools/logging/Logger.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 '\Asymptix\core\Tools' in method 'setCurrentPage'.
Open

        if (Tools::isInteger($currentPage)) {

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 method setValueWithComplexName uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else { // Simple key is provided
                $array[$complexName] = $value;
            }
Severity: Minor
Found in framework/helpers/Naming.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method upperCaseFirst uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $firstLetter = mb_substr(mb_strtoupper($str), 0, 1);

            return ($firstLetter . mb_substr($str, 1));
        }
Severity: Minor
Found in framework/helpers/StringHelper.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

start accesses the super-global variable $_COOKIE.
Open

    public static function start($name = "", array $iniSettings = [], $useCookie = false,
            $lifetime = null, $path = null, $domain = null, $secure = null, $httponly = null)
    {
        if (!empty($iniSettings)) {
            foreach ($iniSettings as $key => $value) {
Severity: Minor
Found in framework/web/Session.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Severity
Category
Status
Source
Language