gdbots/pbjx-php

View on GitHub
src/EventSearch/Elastica/ElasticaEventSearch.php

Summary

Maintainability
D
2 days
Test Coverage

File ElasticaEventSearch.php has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
declare(strict_types=1);

namespace Gdbots\Pbjx\EventSearch\Elastica;

Severity: Minor
Found in src/EventSearch/Elastica/ElasticaEventSearch.php - About 3 hrs to fix

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

        final public function searchEvents(Message $request, ParsedQuery $parsedQuery, Message $response, array $curies = [], array $context = []): void
        {
            $context = $this->enrichContext(__FUNCTION__, $context);
            $skipValidation = filter_var($context['skip_validation'] ?? true, FILTER_VALIDATE_BOOLEAN);
            $client = $this->getClientForRead($context);
    Severity: Major
    Found in src/EventSearch/Elastica/ElasticaEventSearch.php - About 2 hrs to fix

      Method indexEvents has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          final public function indexEvents(array $events, array $context = []): void
          {
              if (empty($events)) {
                  return;
              }
      Severity: Major
      Found in src/EventSearch/Elastica/ElasticaEventSearch.php - About 2 hrs to fix

        Method deleteEvents has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            final public function deleteEvents(array $eventIds, array $context = []): void
            {
                if (empty($eventIds)) {
                    return;
                }
        Severity: Minor
        Found in src/EventSearch/Elastica/ElasticaEventSearch.php - About 1 hr to fix

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

              final public function createStorage(array $context = []): void
              {
                  $context = $this->enrichContext(__FUNCTION__, $context);
          
                  if (isset($context['cluster'])) {
          Severity: Minor
          Found in src/EventSearch/Elastica/ElasticaEventSearch.php - About 1 hr to fix

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

                final public function describeStorage(array $context = []): string
                {
                    $context = $this->enrichContext(__FUNCTION__, $context);
            
                    if (isset($context['cluster'])) {
            Severity: Minor
            Found in src/EventSearch/Elastica/ElasticaEventSearch.php - About 1 hr to fix

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

                  final public function describeStorage(array $context = []): string
                  {
                      $context = $this->enrichContext(__FUNCTION__, $context);
              
                      if (isset($context['cluster'])) {
              Severity: Minor
              Found in src/EventSearch/Elastica/ElasticaEventSearch.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 createStorage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  final public function createStorage(array $context = []): void
                  {
                      $context = $this->enrichContext(__FUNCTION__, $context);
              
                      if (isset($context['cluster'])) {
              Severity: Minor
              Found in src/EventSearch/Elastica/ElasticaEventSearch.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 __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      ClientManager $clientManager,
                      EventDispatcher $dispatcher,
                      IndexManager $indexManager,
                      ?LoggerInterface $logger = null,
                      ?string $timeout = null
              Severity: Minor
              Found in src/EventSearch/Elastica/ElasticaEventSearch.php - About 35 mins to fix

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

                    final public function searchEvents(Message $request, ParsedQuery $parsedQuery, Message $response, array $curies = [], array $context = []): void
                Severity: Minor
                Found in src/EventSearch/Elastica/ElasticaEventSearch.php - About 35 mins to fix

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

                      final public function indexEvents(array $events, array $context = []): void
                      {
                          if (empty($events)) {
                              return;
                          }
                  Severity: Minor
                  Found in src/EventSearch/Elastica/ElasticaEventSearch.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

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

                      final public function deleteEvents(array $eventIds, array $context = []): void
                      {
                          if (empty($eventIds)) {
                              return;
                          }
                  Severity: Minor
                  Found in src/EventSearch/Elastica/ElasticaEventSearch.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