kitsunet/Flowpack.SimpleSearch

View on GitHub

Showing 14 of 24 total issues

MysqlQueryBuilder has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class MysqlQueryBuilder implements QueryBuilderInterface
{
    /**
     * @var IndexInterface
     */
Severity: Minor
Found in Classes/Search/MysqlQueryBuilder.php - About 2 hrs to fix

    Function determineSnippetLocation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private function determineSnippetLocation(array $locations, int $relativePosition): int
        {
            $locationsCount = count($locations);
            $smallestDiff = PHP_INT_MAX;
    
    
    Severity: Minor
    Found in Classes/Search/MysqlQueryBuilder.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 createIndexTables has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function createIndexTables(): void
        {
            $result = $this->connection->query('SHOW TABLES');
            $tables = $result->fetchAll(\PDO::FETCH_COLUMN);
    
    
    Severity: Minor
    Found in Classes/Domain/Service/MysqlIndex.php - About 1 hr to fix

      Method fulltextMatchResult has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function fulltextMatchResult($searchword, $resultTokens = 200, $ellipsis = '...', $beginModifier = '<b>', $endModifier = '</b>'): string
          {
              $searchword = trim($searchword);
      
              $query = $this->buildQueryString();
      Severity: Minor
      Found in Classes/Search/MysqlQueryBuilder.php - About 1 hr to fix

        Function likeAnyMatch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function likeAnyMatch(string $propertyName, array $propertyValues): QueryBuilderInterface
            {
                if ($propertyValues === null || empty($propertyValues) || $propertyValues[0] === null) {
                    return $this;
                }
        Severity: Minor
        Found in Classes/Search/SqLiteQueryBuilder.php - About 45 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 anyMatch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function anyMatch(string $propertyName, array $propertyValues): QueryBuilderInterface
            {
                if ($propertyValues === null || empty($propertyValues) || $propertyValues[0] === null) {
                    return $this;
                }
        Severity: Minor
        Found in Classes/Search/MysqlQueryBuilder.php - About 45 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 anyMatch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function anyMatch(string $propertyName, array $propertyValues): QueryBuilderInterface
            {
                if ($propertyValues === null || empty($propertyValues) || $propertyValues[0] === null) {
                    return $this;
                }
        Severity: Minor
        Found in Classes/Search/SqLiteQueryBuilder.php - About 45 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 likeAnyMatch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function likeAnyMatch(string $propertyName, array $propertyValues): QueryBuilderInterface
            {
                if ($propertyValues === null || empty($propertyValues) || $propertyValues[0] === null) {
                    return $this;
                }
        Severity: Minor
        Found in Classes/Search/MysqlQueryBuilder.php - About 45 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

        Method fulltextMatchResult has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function fulltextMatchResult(string $searchword, int $resultTokens = 60, string $ellipsis = '...', string $beginModifier = '<b>', string $endModifier = '</b>'): string
        Severity: Minor
        Found in Classes/Search/SqLiteQueryBuilder.php - About 35 mins to fix

          Method fulltextMatchResult has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function fulltextMatchResult($searchword, $resultTokens = 200, $ellipsis = '...', $beginModifier = '<b>', $endModifier = '</b>'): string
          Severity: Minor
          Found in Classes/Search/MysqlQueryBuilder.php - About 35 mins to fix

            Method extractSnippet has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private function extractSnippet(int $resultTokens, string $ellipsis, int $matchLength, int $snippetLocation, string $matchContent): string
            Severity: Minor
            Found in Classes/Search/MysqlQueryBuilder.php - About 35 mins to fix

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

                  public function initializeObject(): void
                  {
                      $databaseFilePath = $this->storageFolder . md5($this->getIndexName()) . '.db';
                      $createDatabaseTables = false;
              
              
              Severity: Minor
              Found in Classes/Domain/Service/SqLiteIndex.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 fulltextMatchResult has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function fulltextMatchResult(string $searchword, int $resultTokens = 60, string $ellipsis = '...', string $beginModifier = '<b>', string $endModifier = '</b>'): string
                  {
                      $query = $this->buildQueryString();
                      $results = $this->indexClient->executeStatement($query, $this->parameterMap);
                      // SQLite3 has a hard-coded limit of 999 query variables, so we split the $result in chunks
              Severity: Minor
              Found in Classes/Search/SqLiteQueryBuilder.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 fulltextMatchResult has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function fulltextMatchResult($searchword, $resultTokens = 200, $ellipsis = '...', $beginModifier = '<b>', $endModifier = '</b>'): string
                  {
                      $searchword = trim($searchword);
              
                      $query = $this->buildQueryString();
              Severity: Minor
              Found in Classes/Search/MysqlQueryBuilder.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