spotweb/spotweb

View on GitHub
lib/services/Search/Services_Search_QueryParser.php

Summary

Maintainability
F
1 wk
Test Coverage

Function compressCategorySelection has a Cognitive Complexity of 157 (exceeds 5 allowed). Consider refactoring.
Open

    public function compressCategorySelection($categoryList, $strongNotList)
    {
        SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
        $compressedList = '';

Severity: Minor
Found in lib/services/Search/Services_Search_QueryParser.php - About 3 days 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 prepareCategorySelection has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepareCategorySelection($dynaList)
    {
        SpotTiming::start(__CLASS__.'::'.__FUNCTION__);

        $strongNotList = [];
Severity: Minor
Found in lib/services/Search/Services_Search_QueryParser.php - About 1 day 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 Services_Search_QueryParser.php has 532 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

class Services_Search_QueryParser
{
    /*
Severity: Major
Found in lib/services/Search/Services_Search_QueryParser.php - About 1 day to fix

    Function filterValuesToSql has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

        private function filterValuesToSql($filterValueList, $currentSession)
        {
            SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
    
            // Add a list of possible text searches
    Severity: Minor
    Found in lib/services/Search/Services_Search_QueryParser.php - About 1 day 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 categoryListToSql has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        private function categoryListToSql($categoryList)
        {
            SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
            $categorySql = [];
    
    
    Severity: Minor
    Found in lib/services/Search/Services_Search_QueryParser.php - About 5 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 filterValuesToSql has 140 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function filterValuesToSql($filterValueList, $currentSession)
        {
            SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
    
            // Add a list of possible text searches
    Severity: Major
    Found in lib/services/Search/Services_Search_QueryParser.php - About 5 hrs to fix

      Function prepareFilterValues has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          private function prepareFilterValues($search)
          {
              SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
              $filterValueList = [];
      
      
      Severity: Minor
      Found in lib/services/Search/Services_Search_QueryParser.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 prepareCategorySelection has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function prepareCategorySelection($dynaList)
          {
              SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
      
              $strongNotList = [];
      Severity: Major
      Found in lib/services/Search/Services_Search_QueryParser.php - About 3 hrs to fix

        Function strongNotListToSql has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            private function strongNotListToSql($strongNotList)
            {
                SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
                $strongNotSql = [];
        
        
        Severity: Minor
        Found in lib/services/Search/Services_Search_QueryParser.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 compressCategorySelection has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function compressCategorySelection($categoryList, $strongNotList)
            {
                SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
                $compressedList = '';
        
        
        Severity: Major
        Found in lib/services/Search/Services_Search_QueryParser.php - About 2 hrs to fix

          Method filterToQuery has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function filterToQuery($search, $sort, $currentSession, $indexFilter)
              {
                  SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
          
                  $isUnfiltered = false;
          Severity: Major
          Found in lib/services/Search/Services_Search_QueryParser.php - About 2 hrs to fix

            Method prepareFilterValues has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function prepareFilterValues($search)
                {
                    SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
                    $filterValueList = [];
            
            
            Severity: Minor
            Found in lib/services/Search/Services_Search_QueryParser.php - About 1 hr to fix

              Method categoryListToSql has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function categoryListToSql($categoryList)
                  {
                      SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
                      $categorySql = [];
              
              
              Severity: Minor
              Found in lib/services/Search/Services_Search_QueryParser.php - About 1 hr to fix

                Method strongNotListToSql has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function strongNotListToSql($strongNotList)
                    {
                        SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
                        $strongNotSql = [];
                
                
                Severity: Minor
                Found in lib/services/Search/Services_Search_QueryParser.php - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                                          if (strpos(','.$compressedList.',', ',cat'.$headCatNumber.'_'.$subType.'_'.$subCatKey.',') === false) {
                                                                              $compressedList .= 'cat'.$headCatNumber.'_'.$subType.'_'.$subCatKey.',';
                                                                          } // if
                  Severity: Major
                  Found in lib/services/Search/Services_Search_QueryParser.php - About 45 mins to fix

                    Function filterToQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function filterToQuery($search, $sort, $currentSession, $indexFilter)
                        {
                            SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
                    
                            $isUnfiltered = false;
                    Severity: Minor
                    Found in lib/services/Search/Services_Search_QueryParser.php - About 35 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