gdbots/ncr-php

View on GitHub

Showing 72 of 92 total issues

Method putNode has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function putNode(Message $node, ?string $expectedEtag = null, array $context = []): void
    {
        $node->freeze();
        $nodeRef = $node->generateNodeRef();

Severity: Minor
Found in src/Repository/DynamoDb/DynamoDbNcr.php - About 2 hrs to fix

    Method updateNode has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function updateNode(Message $command): void
        {
            /** @var NodeRef $nodeRef */
            $nodeRef = $command->get('node_ref');
            $this->assertNodeRefMatches($nodeRef);
    Severity: Minor
    Found in src/Aggregate.php - About 1 hr to fix

      Method deleteNodes has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function deleteNodes(array $nodeRefs, array $context = []): void
          {
              if (empty($nodeRefs)) {
                  return;
              }
      Severity: Minor
      Found in src/Search/Elastica/ElasticaNcrSearch.php - About 1 hr to fix

        Method derefNodes has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function derefNodes(Message $node, array $fields, ?string $return = null): array
            {
                $nodeRefs = [];
                foreach ($fields as $field) {
                    if (!$node->has($field)) {
        Severity: Minor
        Found in src/NcrCache.php - About 1 hr to fix

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

              public function getNodes(array $nodeRefs, bool $consistent = false, array $context = []): array
              {
                  $context = $this->enrichContext(__FUNCTION__, $context);
          
                  if (empty($nodeRefs)) {
          Severity: Minor
          Found in src/Repository/DynamoDb/DynamoDbNcr.php - About 1 hr to fix

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

                public function getNodes(array $nodeRefs, bool $consistent = false, array $context = []): array
                {
                    if (empty($nodeRefs)) {
                        return [];
                    }
            Severity: Minor
            Found in src/Repository/MemoizingNcr.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 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/Search/Elastica/ClientManager.php - About 1 hr to fix

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

                  public function handleRequest(Message $request, Pbjx $pbjx): Message
                  {
                      $consistent = $request->get('consistent_read');
                      $response = $this->createGetNodeResponse($request, $pbjx);
                      $context = ['causator' => $request];
              Severity: Minor
              Found in src/GetNodeRequestHandler.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 createQuery has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  final public function createQuery(IndexQuery $query): array
                  {
                      $filterables = $this->getFilterableAttributes();
                      $params = [
                          'IndexName'                 => $this->getName(),
              Severity: Minor
              Found in src/Repository/DynamoDb/AbstractIndex.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 getItems has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getItems(): array
                  {
                      $allItems = [];
              
                      while ($this->queue) {
              Severity: Minor
              Found in src/Repository/DynamoDb/BatchGetItemRequest.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 publishNode has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function publishNode(Message $command, ?\DateTimeZone $localTimeZone = null): void
                  {
                      if (!$this->node::schema()->hasMixin('gdbots:ncr:mixin:publishable')) {
                          throw new InvalidArgumentException(
                              "Node [{$this->nodeRef}] must have [gdbots:ncr:mixin:publishable]."
              Severity: Minor
              Found in src/Aggregate.php - About 1 hr to fix

                Method handleRequest has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function handleRequest(Message $request, Pbjx $pbjx): Message
                    {
                        $consistent = $request->get('consistent_read');
                        $response = $this->createGetNodeResponse($request, $pbjx);
                        $context = ['causator' => $request];
                Severity: Minor
                Found in src/GetNodeRequestHandler.php - About 1 hr to fix

                  Method applyDateFilters has 37 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/Search/Elastica/QueryFactory.php - About 1 hr to fix

                    Method hasNode has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function hasNode(NodeRef $nodeRef, bool $consistent = false, array $context = []): bool
                        {
                            $context = $this->enrichContext(__FUNCTION__, $context);
                            $tableName = $this->tableManager->getNodeTableName($nodeRef->getQName(), $context);
                    
                    
                    Severity: Minor
                    Found in src/Repository/DynamoDb/DynamoDbNcr.php - About 1 hr to fix

                      Method getNode has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          final public function getNode(NodeRef $nodeRef, bool $consistent = false, array $context = []): Message
                          {
                              $cacheKey = $this->getCacheKey($nodeRef, $context);
                              $cacheItem = null;
                      
                      
                      Severity: Minor
                      Found in src/Repository/Psr6Ncr.php - About 1 hr to fix

                        Function getNode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getNode(NodeRef $nodeRef, bool $consistent = false, array $context = []): Message
                            {
                                $context = $this->enrichContext(__FUNCTION__, $context);
                                $tableName = $this->tableManager->getNodeTableName($nodeRef->getQName(), $context);
                        
                        
                        Severity: Minor
                        Found in src/Repository/DynamoDb/DynamoDbNcr.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 updateNode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function updateNode(Message $command): void
                            {
                                /** @var NodeRef $nodeRef */
                                $nodeRef = $command->get('node_ref');
                                $this->assertNodeRefMatches($nodeRef);
                        Severity: Minor
                        Found in src/Aggregate.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 deleteNode has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function deleteNode(NodeRef $nodeRef, array $context = []): void
                            {
                                $context = $this->enrichContext(__FUNCTION__, $context);
                                $tableName = $this->tableManager->getNodeTableName($nodeRef->getQName(), $context);
                        
                        
                        Severity: Minor
                        Found in src/Repository/DynamoDb/DynamoDbNcr.php - About 1 hr to fix

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

                              public function publishNode(Message $command, ?\DateTimeZone $localTimeZone = null): void
                              {
                                  if (!$this->node::schema()->hasMixin('gdbots:ncr:mixin:publishable')) {
                                      throw new InvalidArgumentException(
                                          "Node [{$this->nodeRef}] must have [gdbots:ncr:mixin:publishable]."
                          Severity: Minor
                          Found in src/Aggregate.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 createIndex has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              final public function createIndex(Client $client, SchemaQName $qname, array $context = []): Index
                              {
                                  static $created = [];
                          
                                  $indexName = $this->getIndexName($qname, $context);
                          Severity: Minor
                          Found in src/Search/Elastica/IndexManager.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

                          Severity
                          Category
                          Status
                          Source
                          Language