protected/modules/zendsearch/vendors/Zend/Search/Lucene.php

Summary

Maintainability
F
6 days
Test Coverage

File Lucene.php has 755 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Zend Framework
 *
 * LICENSE
Severity: Major
Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.php - About 1 day to fix

    Function find has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
    Open

        public function find($query)
        {
            if (is_string($query)) {
                require_once 'Zend/Search/Lucene/Search/QueryParser.php';
    
    
    Severity: Minor
    Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.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

    Zend_Search_Lucene has 56 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Zend_Search_Lucene implements Zend_Search_Lucene_Interface
    {
        /**
         * Default field name for search
         *
    Severity: Major
    Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.php - About 1 day to fix

      Method find has 114 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function find($query)
          {
              if (is_string($query)) {
                  require_once 'Zend/Search/Lucene/Search/QueryParser.php';
      
      
      Severity: Major
      Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.php - About 4 hrs to fix

        Function _readSegmentsFile has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            private function _readSegmentsFile()
            {
                $segmentsFile = $this->_directory->getFileObject(self::getSegmentFileName($this->_generation));
        
                $format = $segmentsFile->readInt();
        Severity: Minor
        Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.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 _readSegmentsFile has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function _readSegmentsFile()
            {
                $segmentsFile = $this->_directory->getFileObject(self::getSegmentFileName($this->_generation));
        
                $format = $segmentsFile->readInt();
        Severity: Major
        Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.php - About 2 hrs to fix

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

              public static function getActualGeneration(Zend_Search_Lucene_Storage_Directory $directory)
              {
                  /**
                   * Zend_Search_Lucene uses segments.gen file to retrieve current generation number
                   *
          Severity: Minor
          Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.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

          Function __construct has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __construct($directory = null, $create = false)
              {
                  if ($directory === null) {
                      require_once 'Zend/Search/Lucene/Exception.php';
                      throw new Zend_Search_Exception('No index directory specified');
          Severity: Minor
          Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.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 __construct has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __construct($directory = null, $create = false)
              {
                  if ($directory === null) {
                      require_once 'Zend/Search/Lucene/Exception.php';
                      throw new Zend_Search_Exception('No index directory specified');
          Severity: Minor
          Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.php - About 1 hr to fix

            Method getDocument has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getDocument($id)
                {
                    if ($id instanceof Zend_Search_Lucene_Search_QueryHit) {
                        /* @var $id Zend_Search_Lucene_Search_QueryHit */
                        $id = $id->id;
            Severity: Minor
            Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.php - About 1 hr to fix

              Method getActualGeneration has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getActualGeneration(Zend_Search_Lucene_Storage_Directory $directory)
                  {
                      /**
                       * Zend_Search_Lucene uses segments.gen file to retrieve current generation number
                       *
              Severity: Minor
              Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.php - About 1 hr to fix

                Function getDocument has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getDocument($id)
                    {
                        if ($id instanceof Zend_Search_Lucene_Search_QueryHit) {
                            /* @var $id Zend_Search_Lucene_Search_QueryHit */
                            $id = $id->id;
                Severity: Minor
                Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.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

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

                    public function terms()
                    {
                        $result = [];
                
                        /** Zend_Search_Lucene_Index_TermsPriorityQueue */
                Severity: Minor
                Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.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

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

                    public function norm($id, $fieldName)
                    {
                        if ($id >= $this->_docCount) {
                            return null;
                        }
                Severity: Minor
                Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function delete($id)
                    {
                        if ($id instanceof Zend_Search_Lucene_Search_QueryHit) {
                            /* @var $id Zend_Search_Lucene_Search_QueryHit */
                            $id = $id->id;
                Severity: Minor
                Found in protected/modules/zendsearch/vendors/Zend/Search/Lucene.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

                There are no issues that match your filters.

                Category
                Status