ctrl-f5/ctrl-common

View on GitHub
src/Criteria/Resolver.php

Summary

Maintainability
D
2 days
Test Coverage

Function parseGraph has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parseGraph(array $graph = array(), array &$values, &$currentKey)
    {
        $type   = key($graph);
        $parsed = [];
        $joins  = [];
Severity: Minor
Found in src/Criteria/Resolver.php - About 3 hrs 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 tokenize has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function tokenize(array $expressions)
    {
        $tokens = array();

        foreach ($expressions as $expr) {
Severity: Minor
Found in src/Criteria/Resolver.php - About 3 hrs 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

File Resolver.php has 284 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Ctrl\Common\Criteria;

use Ctrl\Common\Tools\StringHelper;
Severity: Minor
Found in src/Criteria/Resolver.php - About 2 hrs to fix

    Function getFieldConfig has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getFieldConfig($expr, $root)
        {
            if (strpos($expr, ' ') === false) {
                $field = $expr;
                $condition = '=';
    Severity: Minor
    Found in src/Criteria/Resolver.php - About 2 hrs 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

    Method getFieldConfig has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function getFieldConfig($expr, $root)
        {
            if (strpos($expr, ' ') === false) {
                $field = $expr;
                $condition = '=';
    Severity: Major
    Found in src/Criteria/Resolver.php - About 2 hrs to fix

      Function resolveCriteria has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function resolveCriteria($criteria, $type = self::T_AND)
          {
              if (!is_array($criteria)) {
                  $criteria   = array($criteria);
              }
      Severity: Minor
      Found in src/Criteria/Resolver.php - About 2 hrs 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

      Method parseGraph has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function parseGraph(array $graph = array(), array &$values, &$currentKey)
          {
              $type   = key($graph);
              $parsed = [];
              $joins  = [];
      Severity: Minor
      Found in src/Criteria/Resolver.php - About 1 hr to fix

        Method resolveCriteria has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function resolveCriteria($criteria, $type = self::T_AND)
            {
                if (!is_array($criteria)) {
                    $criteria   = array($criteria);
                }
        Severity: Minor
        Found in src/Criteria/Resolver.php - About 1 hr to fix

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

              public function createGraph($tokens)
              {
                  if (is_string($tokens)) {
                      $tokens = $this->tokenize(StringHelper::bracesToArray($tokens));
                  }
          Severity: Minor
          Found in src/Criteria/Resolver.php - About 1 hr 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

          Method tokenize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function tokenize(array $expressions)
              {
                  $tokens = array();
          
                  foreach ($expressions as $expr) {
          Severity: Minor
          Found in src/Criteria/Resolver.php - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status