gdbots/pbjx-php

View on GitHub

Showing 94 of 107 total issues

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

    private function getNestedMessages(Message $message, Schema $schema): array
    {
        $messages = [];

        foreach ($schema->getFields() as $field) {
Severity: Minor
Found in src/SimplePbjx.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 getItemKeyByEventId has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getItemKeyByEventId(Identifier $eventId, array $context = []): ?array
    {
        $tableName = $this->getTableNameForRead($context);
        $params = [
            'TableName'                 => $tableName,
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 deleteEvent has a Cognitive Complexity of 10 (exceeds 5 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

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 applyDateFilters has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function applyDateFilters(Message $request, ParsedQuery $parsedQuery): void
    {
        $required = BoolOperator::REQUIRED;

        $dateFilters = [
Severity: Minor
Found in src/EventSearch/Elastica/QueryFactory.php - About 1 hr to fix

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

        public static function create(string $content, string $aud, string $kid, string $secret, array $options = []): self
        {
            $header = [
                'alg' => self::ALGO,
                'typ' => 'JWT',
    Severity: Minor
    Found in src/PbjxToken.php - About 1 hr to fix

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

          public function __construct(Pbjx $pbjx, array $streams = [])
          {
              $this->pbjx = $pbjx;
      
              foreach ($streams as $streamId => $events) {
      Severity: Minor
      Found in src/EventStore/InMemoryEventStore.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 dispatch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          private function dispatch(Message $event, string $eventName): void
          {
              foreach ($this->dispatcher->getListeners($eventName) as $listener) {
                  try {
                      call_user_func($listener, $event, $this->pbjx);
      Severity: Minor
      Found in src/SimpleEventBus.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 copyContext has a Cognitive Complexity of 9 (exceeds 5 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 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

      Method getStreamSlice has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function getStreamSlice(StreamId $streamId, ?Microtime $since = null, int $count = 25, bool $forward = true, bool $consistent = false, array $context = []): StreamSlice;
      Severity: Minor
      Found in src/EventStore/EventStore.php - About 45 mins to fix

        Method getStreamSlice has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function getStreamSlice(StreamId $streamId, ?Microtime $since = null, int $count = 25, bool $forward = true, bool $consistent = false, array $context = []): StreamSlice
        Severity: Minor
        Found in src/EventStore/TwoPhaseCommitEventStore.php - About 45 mins to fix

          Method getStreamSlice has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function getStreamSlice(StreamId $streamId, ?Microtime $since = null, int $count = 25, bool $forward = true, bool $consistent = false, array $context = []): StreamSlice
          Severity: Minor
          Found in src/EventStore/InMemoryEventStore.php - About 45 mins to fix

            Function checkClaims has a Cognitive Complexity of 8 (exceeds 5 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 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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    DynamoDbClient $dynamoDbClient,
                    string $tableName,
                    SfnClient $sfnClient,
                    string $stateMachineArn,
                    EventDispatcher $dispatcher,
            Severity: Minor
            Found in src/Scheduler/DynamoDb/DynamoDbScheduler.php - About 45 mins to fix

              Function getClient has a Cognitive Complexity of 8 (exceeds 5 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 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 getStreamSlice has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  final public function getStreamSlice(StreamId $streamId, ?Microtime $since = null, int $count = 25, bool $forward = true, bool $consistent = false, array $context = []): StreamSlice
              Severity: Minor
              Found in src/EventStore/DynamoDb/DynamoDbEventStore.php - About 45 mins to fix

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

                        Pbjx $pbjx,
                        DynamoDbClient $client,
                        string $tableName,
                        EventDispatcher $dispatcher,
                        ?LoggerInterface $logger = null
                Severity: Minor
                Found in src/EventStore/DynamoDb/DynamoDbEventStore.php - About 35 mins to fix

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

                      public function __construct(array $events = [], ?StreamId $streamId = null, bool $forward = true, bool $consistent = false, bool $hasMore = false)
                  Severity: Minor
                  Found in src/EventStore/StreamSlice.php - About 35 mins to fix

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

                        public static function create(string $content, string $aud, string $kid, string $secret, array $options = []): self
                    Severity: Minor
                    Found in src/PbjxToken.php - About 35 mins to fix

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

                          public function trigger(Message $message, string $suffix, ?PbjxEvent $event = null, bool $recursive = true, bool $throw = true): static;
                      Severity: Minor
                      Found in src/Pbjx.php - About 35 mins to fix

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

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