ctrl-f5/ctrl-common

View on GitHub

Showing 38 of 38 total issues

File ResolverTest.php has 462 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Ctrl\Common\Test\Criteria;

use Ctrl\Common\Criteria\Resolver;
Severity: Minor
Found in test/EntityService/Criteria/ResolverTest.php - About 7 hrs to fix

    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 createQueryExpression has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        public function createQueryExpression(QueryBuilder $qb, array $graph = array())
        {
            $key        = key($graph);
            $expr       = null;
    
    
    Severity: Minor
    Found in src/Criteria/Adapter/DoctrineAdapter.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

    Method createQueryExpression has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function createQueryExpression(QueryBuilder $qb, array $graph = array())
        {
            $key        = key($graph);
            $expr       = null;
    
    
    Severity: Major
    Found in src/Criteria/Adapter/DoctrineAdapter.php - About 3 hrs to fix

      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

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

              public function test_resolve_string_braces()
              {
                  $resolver = $this->getResolver('root');
          
                  $result = $resolver->resolveCriteria('root.id = 1 and (id IS NULL or root.active = false)');
          Severity: Major
          Found in test/EntityService/Criteria/ResolverTest.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 test_resolve_conditions_with_mixed_parameters has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function test_resolve_conditions_with_mixed_parameters()
                {
                    $resolver = $this->getResolver('root');
            
                    $result = $resolver->resolveCriteria([
            Severity: Major
            Found in test/EntityService/Criteria/ResolverTest.php - About 2 hrs to fix

              Function bracesToArray has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function bracesToArray($string, $braces = self::BRACKET_ROUND, $first = true)
                  {
                      $OPEN       = $braces[0];
                      $CLOSE      = $braces[1];
                      $result     = array();
              Severity: Minor
              Found in src/Tools/StringHelper.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 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 bracesToArray has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function bracesToArray($string, $braces = self::BRACKET_ROUND, $first = true)
                      {
                          $OPEN       = $braces[0];
                          $CLOSE      = $braces[1];
                          $result     = array();
                  Severity: Minor
                  Found in src/Tools/StringHelper.php - About 1 hr to fix

                    Method test_resolve_conditions_with_named_parameters has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function test_resolve_conditions_with_named_parameters()
                        {
                            $resolver = $this->getResolver('root');
                    
                            $result = $resolver->resolveCriteria(array('id = :id' => ['id' => 1]));
                    Severity: Minor
                    Found in test/EntityService/Criteria/ResolverTest.php - About 1 hr to fix

                      Method test_resolve_conditions_with_parameters has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function test_resolve_conditions_with_parameters()
                          {
                              $resolver = $this->getResolver('root');
                      
                              $result = $resolver->resolveCriteria(array('root.id' => 1));
                      Severity: Minor
                      Found in test/EntityService/Criteria/ResolverTest.php - About 1 hr to fix

                        Method test_create_graph has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function test_create_graph()
                            {
                                $resolver = $this->getResolver('root');
                        
                                $result = $resolver->createGraph('test');
                        Severity: Minor
                        Found in test/EntityService/Criteria/ResolverTest.php - About 1 hr to fix

                          Method test_resolve_array_with_values has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function test_resolve_array_with_values()
                              {
                                  $resolver = $this->getResolver('root');
                          
                                  $result = $resolver->resolveCriteria(array('id' => 1));
                          Severity: Minor
                          Found in test/EntityService/Criteria/ResolverTest.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language