gdbots/pbjx-php

View on GitHub

Showing 94 of 107 total issues

Method updateNormalizers has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function updateNormalizers(Index $index, string $name): void
    {
        $settings = $index->getSettings();
        $customNormalizers = $this->getCustomNormalizers();
        $missingNormalizers = [];
Severity: Minor
Found in src/EventSearch/Elastica/IndexManager.php - About 1 hr to fix

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

        public function getStreamSlice(StreamId $streamId, ?Microtime $since = null, int $count = 25, bool $forward = true, bool $consistent = false, array $context = []): StreamSlice
        {
            $key = $streamId->toString();
            if (!isset($this->streams[$key])) {
                return new StreamSlice([], $streamId, $forward, $consistent, false);
    Severity: Minor
    Found in src/EventStore/InMemoryEventStore.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 cancelJobs has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function cancelJobs(array $jobIds, array $context = []): void
        {
            $context = $this->enrichContext(__FUNCTION__, $context);
            $tableName = $this->getTableName($context);
    
    
    Severity: Minor
    Found in src/Scheduler/DynamoDb/DynamoDbScheduler.php - About 1 hr to fix

      Method getClient has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getClient(string $cluster = 'default'): Client
          {
              if (isset($this->clients[$cluster])) {
                  return $this->clients[$cluster];
              }
      Severity: Minor
      Found in src/EventSearch/Elastica/ClientManager.php - About 1 hr to fix

        Method trigger has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function trigger(Message $message, string $suffix, ?PbjxEvent $event = null, bool $recursive = true, bool $throw = true): static
            {
                $suffix = '.' . trim($suffix, '.');
                if ('.' === $suffix) {
                    throw new InvalidArgumentException('Trigger requires a non-empty suffix.');
        Severity: Minor
        Found in src/SimplePbjx.php - About 1 hr to fix

          Function startExecution has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function startExecution(
                  string $stateMachineArn,
                  int $timestamp,
                  string $jobId,
                  ?string $tenantId = null
          Severity: Minor
          Found in src/Scheduler/DynamoDb/DynamoDbScheduler.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 getEvent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              final public function getEvent(Identifier $eventId, array $context = []): Message
              {
                  $context = $this->enrichContext(__FUNCTION__, $context);
                  $tableName = $this->getTableNameForRead($context);
                  $key = $this->getItemKeyByEventId($eventId, $context);
          Severity: Minor
          Found in src/EventStore/DynamoDb/DynamoDbEventStore.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 putEvents has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              final public function putEvents(StreamId $streamId, array $events, ?string $expectedEtag = null, array $context = []): void
              {
                  if (!count($events)) {
                      // ignore empty events array
                      return;
          Severity: Minor
          Found in src/EventStore/DynamoDb/DynamoDbEventStore.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 sendAt has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public function sendAt(Message $command, int $timestamp, ?string $jobId = null, array $context = []): string
              {
                  $context['causator'] = $command;
                  $context = $this->enrichContext(__FUNCTION__, $context);
                  $ttl = strtotime('+7 days', $timestamp);
          Severity: Minor
          Found in src/Scheduler/DynamoDb/DynamoDbScheduler.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 vendorToHttp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function vendorToHttp(Code $code = Code::OK): HttpCode
              {
                  if (Code::OK === $code) {
                      return HttpCode::HTTP_OK;
                  }
          Severity: Minor
          Found in src/Util/StatusCodeUtil.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 httpToVendor has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function httpToVendor(HttpCode $httpCode = HttpCode::HTTP_OK): Code
                  {
                      if ($httpCode->value < 400) {
                          return Code::OK;
                      }
              Severity: Minor
              Found in src/Util/StatusCodeUtil.php - About 1 hr to fix

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

                    final public function deleteEvent(Identifier $eventId, array $context = []): void
                    {
                        $context = $this->enrichContext(__FUNCTION__, $context);
                        $tableName = $this->getTableNameForWrite($context);
                        $key = $this->getItemKeyByEventId($eventId, $context);
                Severity: Minor
                Found in src/EventStore/DynamoDb/DynamoDbEventStore.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

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

                        public function create(DynamoDbClient $client, string $tableName): void
                        {
                            try {
                                $client->describeTable(['TableName' => $tableName]);
                                return;
                    Severity: Minor
                    Found in src/Scheduler/DynamoDb/SchedulerTable.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 getStreamSlice has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getStreamSlice(StreamId $streamId, ?Microtime $since = null, int $count = 25, bool $forward = true, bool $consistent = false, array $context = []): StreamSlice
                          {
                              $key = $streamId->toString();
                              if (!isset($this->streams[$key])) {
                                  return new StreamSlice([], $streamId, $forward, $consistent, false);
                      Severity: Minor
                      Found in src/EventStore/InMemoryEventStore.php - About 1 hr to fix

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

                            private function checkClaims(): void
                            {
                                if (!is_array($this->header)) {
                                    throw new InvalidArgumentException('PbjxToken header encoding is invalid.');
                                }
                        Severity: Minor
                        Found in src/PbjxToken.php - About 1 hr to fix

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

                              public function copyContext(Message $from, Message $to): static
                              {
                                  if ($to->isFrozen()) {
                                      return $this;
                                  }
                          Severity: Minor
                          Found in src/SimplePbjx.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language