Showing 106 of 106 total issues

Avoid unused parameters such as '$request'.
Open

    public function authenticate(Request $request)
Severity: Minor
Found in src/lib360/auth/AllowAll.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 method get uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            if (!isset(self::$types[$type])) {
                throw new TypeNotFoundException("Undefined object type $type");
            }
            $class = self::$types[$type]['base'] . $name;
Severity: Minor
Found in src/lib360/db/object/Factory.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 store uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            static::$table->insertRecord($this->record);
        }
Severity: Minor
Found in src/lib360/db/data/Model.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 getLanguage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $language = Pool::getByName($this->db)->driver->language;
        }
Severity: Minor
Found in src/lib360/db/data/Store.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 '$value'.
Open

        foreach ($data as $key => $value) {
Severity: Minor
Found in src/lib360/db/language/SQL.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 getExecutor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $executor = Pool::getByName($this->db)->driver->executor;
        }
Severity: Minor
Found in src/lib360/db/data/Store.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 getSelectFromView uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                throw new \InvalidArgumentException(
                    "View object join element at index $key must be an instance of \spoof\lib360\db\join\IJoin, \spoof\lib360\db\data\ITable, or string"
                );
            }
Severity: Minor
Found in src/lib360/db/language/SQL.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 '$record'.
Open

        foreach ($this as $key => $record) {
Severity: Minor
Found in src/lib360/db/data/RecordList.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

Avoid using static access to class '\spoof\lib360\db\connection\Pool' in method 'insert'.
Open

        $db = Pool::getByName($this->db);
Severity: Minor
Found in src/lib360/db/data/Table.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 getConditionOperator() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
Open

    public function getConditionOperator(IDriver $driver, ICondition $condition)
    {
        switch ($condition->operator) {
            case Condition::OPERATOR_EQUALS:
                if ($condition->value2->getType() == Value::TYPE_NULL) {
Severity: Minor
Found in src/lib360/db/language/SQL.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

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

The method __construct() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10.
Open

    public function __construct($value, $type = null)
    {
        // validate type and value
        if (is_null($type)) {
            $type = $this->determineType($value);
Severity: Minor
Found in src/lib360/db/value/Value.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

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

getRequest accesses the super-global variable $_SERVER.
Open

    public function getRequest()
    {
        $request = new api\Request();
        if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
            $request->parts = explode('/', $_SERVER['REQUEST_URI']);

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

getRequest accesses the super-global variable $_GET.
Open

    public function getRequest()
    {
        $request = new api\Request();
        if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
            $request->parts = explode('/', $_SERVER['REQUEST_URI']);

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

getRequest accesses the super-global variable $_SERVER.
Open

    public function getRequest()
    {
        $request = new api\Request();
        if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
            $request->parts = explode('/', $_SERVER['REQUEST_URI']);

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

sendResponse accesses the super-global variable $_SERVER.
Open

    public function sendResponse(api\Response $response)
    {
        $protocol = (isset($_SERVER['SERVER_PROTOCOL']) ?
            $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
        $body = null;

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

The method getValue() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
Open

    public function getValue(IDriver $driver, IValue $value)
    {
        $query = new Query();
        switch ($value->getType()) {
            case Value::TYPE_PREPARED:
Severity: Minor
Found in src/lib360/db/language/SQL.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

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

sendResponse accesses the super-global variable $_SERVER.
Open

    public function sendResponse(api\Response $response)
    {
        $protocol = (isset($_SERVER['SERVER_PROTOCOL']) ?
            $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
        $body = null;

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

getRequest accesses the super-global variable $_POST.
Open

    public function getRequest()
    {
        $request = new api\Request();
        if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
            $request->parts = explode('/', $_SERVER['REQUEST_URI']);

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

getRequest accesses the super-global variable $_SERVER.
Open

    public function getRequest()
    {
        $request = new api\Request();
        if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
            $request->parts = explode('/', $_SERVER['REQUEST_URI']);

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

getRequest accesses the super-global variable $_SERVER.
Open

    public function getRequest()
    {
        $request = new api\Request();
        if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
            $request->parts = explode('/', $_SERVER['REQUEST_URI']);

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