Asymptix/Framework

View on GitHub

Showing 720 of 720 total issues

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

            } else {
                if (strlen($types) === count($params)) {
                    $query = preg_replace('/\s+/', ' ', $query);
                    $preparedQuery = $query;

Severity: Minor
Found in framework/db/DBQuery.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 'showQueryDebugInfo'.
Open

                    OutputStream::message(OutputStream::MSG_INFO, "Q: " . $query);
Severity: Minor
Found in framework/db/DBQuery.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 'selectDBObjectsByField'.
Open

            $stmt = DBCore::doSelectQuery($query, $fieldType, [$fieldValue]);
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 save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->changeUpdateTime();
        }
Severity: Minor
Found in framework/db/DBTimedObject.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 validateNotEmpty uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            return validateNotEmpty($fieldName);
        }

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

        } else {
            if ($propertyValue === "") {
                if (isset($this->style[$propertyName])) {
                    unset($this->style[$propertyName]);
                }
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

Avoid using static access to class 'Asymptix\db\DBPreparedQuery' in method 'updateDBObject'.
Open

        $typesString = DBPreparedQuery::sqlTypesString($fieldsList, $idFieldName);
Severity: Minor
Found in framework/db/DBCore.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 updateDBObject uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $typesString.= "s";
        }
Severity: Minor
Found in framework/db/DBCore.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 'insert'.
Open

        return DBCore::insertDBObject($this, $ignore, $debug);
Severity: Minor
Found in framework/db/DBObject.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 '_min'.
Open

            return DBCore::selectSingleValue($dbQuery);
Severity: Minor
Found in framework/db/DBObject.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 'checkParameterTypes'.
Open

                        if (!(Tools::isNumeric($value) && ((string)(int)$value === $value))) {
Severity: Minor
Found in framework/db/DBPreparedQuery.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 sqlPushValues uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $chunks[] = $fieldName;
                }
Severity: Minor
Found in framework/db/DBPreparedQuery.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 'showQueryDebugInfo'.
Open

                OutputStream::message(OutputStream::MSG_INFO, "Q: " . $query);
Severity: Minor
Found in framework/db/DBQuery.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\DBField' in method 'showQueryDebugInfo'.
Open

                        $query = preg_replace("/\?/", DBField::sqlValue($types[$i], $params[$i]), $query, 1);
Severity: Minor
Found in framework/db/DBQuery.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\OutputStream' in method 'showQueryDebugInfo'.
Open

        OutputStream::close();
Severity: Minor
Found in framework/db/DBQuery.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 'selectDBObject'.
Open

                $dbObject = DBCore::selectDBObjectFromStatement($stmt, $this->dbObject);
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 getBouncedEmails uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    if ($endSignaturePos === false || $endSignaturePos <= $failSignaturePos) {
                        $endSignaturePos = strlen($message);
                    }
                    preg_match_all(
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

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

            } else {
                break;
            }
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\Tools' in method 'prepareLimit'.
Open

                if (Tools::isInteger($offset) && Tools::isInteger($count)) {
Severity: Minor
Found in framework/db/DBPreparedQuery.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 checkParameterTypes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else { // in case if we try send non-string parameters as a string value
                switch ($type) {
                    case 'i':
                        if (!(Tools::isNumeric($value) && ((string)(int)$value === $value))) {
                            throw new DBCoreException(
Severity: Minor
Found in framework/db/DBPreparedQuery.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