PHPixie/Database

View on GitHub
src/PHPixie/Database/Driver/Mongo/Parser/Conditions/ExpandedGroup.php

Summary

Maintainability
B
5 hrs
Test Coverage

Function addAnd has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addAnd($condition)
    {
        $newGroups = array();
        if($condition instanceof ExpandedGroup) {
            $groups = $condition->groups();

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function negate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function negate()
    {
        $groups = array(array());
        $count = count($this->groups);
        $negated = array();

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function optimize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function optimize($groups)
    {
        $count = count($groups);
        $remove = array();
        for ($i = 0; $i < $count; $i++) {

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function add has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function add($condition, $logic = 'and')
    {
        $isExpandedGroup = $condition instanceof ExpandedGroup;
        if(!$isExpandedGroup && !(($condition instanceof \PHPixie\Database\Conditions\Condition\Field\Operator))) {
            throw new \PHPixie\Database\Exception\Parser("You can only add ExpandedGroup and Operator conditions");
Severity: Minor
Found in src/PHPixie/Database/Driver/Mongo/Parser/Conditions/ExpandedGroup.php - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

There are no issues that match your filters.

Category
Status