Asymptix/Framework

View on GitHub

Showing 720 of 720 total issues

Avoid using static access to class 'Asymptix\web\Session' in method 'httpRedirect'.
Open

                        Session::set('_post', []);
Severity: Minor
Found in framework/web/Http.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 function http_redirect() contains an exit expression.
Open

        exit();
Severity: Minor
Found in modules/http.php by phpmd

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

The method __construct 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("Empty view template");
        }
Severity: Minor
Found in framework/app/View.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 curlRequestAsync() has an NPath complexity of 432. The configured NPath complexity threshold is 200.
Open

    public static function curlRequestAsync($url, $params, $type = self::POST, $timeout = 30) {
        $postParams = [];
        foreach ($params as $key => &$val) {
            if (is_array($val)) {
                $val = implode(',', $val);
Severity: Minor
Found in framework/web/Http.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid using static access to class '\Asymptix\helpers\Naming' in method 'getFieldValue'.
Open

                    $value = Naming::getValueByComplexName($_GET, $fieldName);
Severity: Minor
Found in framework/web/Request.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\helpers\Naming' in method 'getFieldValue'.
Open

                    $value = Naming::getValueByComplexName($_POST, $fieldName);
Severity: Minor
Found in framework/web/Request.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 'db\DBCore' in method 'save'.
Open

        return DBCore::doUpdateQuery($query, "sss", array(
            $this->id,
            $this->value,
            $this->value
        ));
Severity: Minor
Found in classes/db/Settings.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 'checkLoggedIn'.
Open

        if (Tools::isInstanceOf($_USER, new self)) {
Severity: Minor
Found in classes/db/access/User.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\helpers\Naming' in method 'setFieldValue'.
Open

        Naming::setValueWithComplexName($_FIELDS, $fieldName, $fieldValue);
Severity: Minor
Found in framework/web/Request.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 http_response_code uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $code = (isset($GLOBALS['http_response_code']) ? $GLOBALS['http_response_code'] : 200);
        }
Severity: Minor
Found in modules/http.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\db\DBCore' in method 'updateLoginTime'.
Open

        DBCore::doUpdateQuery($query, "i", array($this->id));
Severity: Minor
Found in classes/db/access/User.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 httpRedirect uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                self::http_redirect("http://" . $_SERVER['SERVER_NAME'] . "/" . $url);
            }
Severity: Minor
Found in framework/web/Http.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\helpers\Naming' in method 'getFieldValue'.
Open

                    $value = Naming::getValueByComplexName(
                        Session::get('_post'), $fieldName
                    );
Severity: Minor
Found in framework/web/Request.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 castFieldValue 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("No field '" . $fieldName . "' in global fields list.");
        }
Severity: Minor
Found in framework/web/Request.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\helpers\Naming' in method 'removeFields'.
Open

            Naming::unsetValueWithComplexName($_FIELDS, $fieldName);
Severity: Minor
Found in framework/web/Request.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\db\DBCore' in method 'updateAvatar'.
Open

            if (DBCore::doUpdateQuery($query, "si", array(
                $newAvatarFileName,
                $this->id
            ))) {
Severity: Minor
Found in classes/db/access/User.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 httpRedirect uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    throw new HttpException("Wrong POST data.");
                }
Severity: Minor
Found in framework/web/Http.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 getRedirectUrl() has an NPath complexity of 384. The configured NPath complexity threshold is 200.
Open

    public static function getRedirectUrl($url) {
        $urlParts = @parse_url($url);
        if (!$urlParts) {
            return false;
        }
Severity: Minor
Found in framework/web/Http.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid using static access to class 'Asymptix\web\Session' in method 'getFieldValue'.
Open

                if (Session::exists('_post')) {
Severity: Minor
Found in framework/web/Request.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 updateAvatar uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                return false;
            }
Severity: Minor
Found in classes/db/access/User.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

Severity
Category
Status
Source
Language