PHPixie/Database

View on GitHub

Showing 66 of 66 total issues

Avoid too many return statements within this method.
Open

                return $this->deleteQuery($query, $runner);
Severity: Major
Found in src/PHPixie/Database/Driver/Mongo/Parser.php - About 30 mins to fix

    Function parseIn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function parseIn($field, $operator, $values)
        {
            $value = $this->singleValue($values, $operator);
            
            if(is_array($value) && count($value) === 0) {
    Severity: Minor
    Found in src/PHPixie/Database/Type/SQL/Parser/Operator.php - About 25 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

    Function selectQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function selectQuery($query, $runner)
        {
            $this->chainCollection($query, $runner);
            $conditions = $this->conditionsParser->parse($query->getWhereConditions());
            
    Severity: Minor
    Found in src/PHPixie/Database/Driver/Mongo/Parser.php - About 25 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

    Function parseIn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function parseIn($field, $operator, $value, $negated, $convertMongoId = false)
        {
            if (count($value)!==1 && !is_array($value[0]))
                throw new \PHPixie\Database\Exception\Parser("The '$operator' operator requires a single array parameter to be passed");
            
    Severity: Minor
    Found in src/PHPixie/Database/Driver/Mongo/Parser/Operator.php - About 25 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

    Function parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function parse($query)
        {
            $expr = $this->database->sqlExpression();
            $type = $query->type();
    
    
    Severity: Minor
    Found in src/PHPixie/Database/Type/SQL/Parser.php - About 25 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

    Function parseBetween has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function parseBetween($field, $operator, $range, $negated, $convertMongoId = false)
        {
            if (!is_array($range) || count($range) !== 2)
                throw new \PHPixie\Database\Exception\Parser("The '$operator' operator requires two parameters to be passed");
            if($operator === 'not between')
    Severity: Minor
    Found in src/PHPixie/Database/Driver/Mongo/Parser/Operator.php - About 25 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

    Severity
    Category
    Status
    Source
    Language