Showing 72 of 92 total issues
File Aggregate.php
has 665 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Gdbots\Ncr;
File DynamoDbNcr.php
has 585 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Gdbots\Ncr\Repository\DynamoDb;
Aggregate
has 62 functions (exceeds 20 allowed). Consider refactoring. Open
class Aggregate
{
protected Message $node;
protected NodeRef $nodeRef;
protected Pbjx $pbjx;
Method doPipeNodes
has 162 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function doPipeNodes(SchemaQName $qname, array $context): \Generator
{
static $alreadyPiped = [];
$tableName = $context['table_name'] ?? $this->tableManager->getNodeTableName($qname, $context);
Function getNodes
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
final public function getNodes(array $nodeRefs, bool $consistent = false, array $context = []): array
{
if (empty($nodeRefs)) {
return [];
} elseif (count($nodeRefs) === 1) {
- Read upRead up
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 derefNodes
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
public function derefNodes(Message $node, array $fields, ?string $return = null): array
{
$nodeRefs = [];
foreach ($fields as $field) {
if (!$node->has($field)) {
- Read upRead up
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 doPipeNodes
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private function doPipeNodes(SchemaQName $qname, array $context): \Generator
{
static $alreadyPiped = [];
$tableName = $context['table_name'] ?? $this->tableManager->getNodeTableName($qname, $context);
- Read upRead up
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 findNodeRefs
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findNodeRefs(IndexQuery $query, array $context = []): IndexQueryResult
{
$context = $this->enrichContext(__FUNCTION__, $context);
$tableName = $this->tableManager->getNodeTableName($query->getQName(), $context);
$table = $this->tableManager->getNodeTable($query->getQName());
Function findNodeRefs
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function findNodeRefs(IndexQuery $query, array $context = []): IndexQueryResult
{
$context = $this->enrichContext(__FUNCTION__, $context);
$tableName = $this->tableManager->getNodeTableName($query->getQName(), $context);
$table = $this->tableManager->getNodeTable($query->getQName());
- Read upRead up
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 addEmbeddedNodeRefs
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function addEmbeddedNodeRefs(array $messages, array $paths): void
{
$nodeRefs = [];
if (array_is_list($paths)) {
- Read upRead up
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 addEmbeddedNodeRefs
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function addEmbeddedNodeRefs(array $messages, array $paths, string $namespace = self::DEFAULT_NAMESPACE): void
{
$nodeRefs = [];
if (array_is_list($paths)) {
- Read upRead up
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
File ElasticaNcrSearch.php
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Gdbots\Ncr\Search\Elastica;
Method getNodes
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function getNodes(array $nodeRefs, bool $consistent = false, array $context = []): array
{
if (empty($nodeRefs)) {
return [];
} elseif (count($nodeRefs) === 1) {
Method searchNodes
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function searchNodes(Message $request, ParsedQuery $parsedQuery, Message $response, array $qnames = [], array $context = []): void
{
$context = $this->enrichContext(__FUNCTION__, $context);
$skipValidation = filter_var($context['skip_validation'] ?? true, FILTER_VALIDATE_BOOLEAN);
$client = $this->getClientForRead($context);
Function getNode
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
final public function getNode(NodeRef $nodeRef, bool $consistent = false, array $context = []): Message
{
$cacheKey = $this->getCacheKey($nodeRef, $context);
$cacheItem = null;
- Read upRead up
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 createQuery
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function createQuery(IndexQuery $query): array
{
$filterables = $this->getFilterableAttributes();
$params = [
'IndexName' => $this->getName(),
Method indexNodes
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function indexNodes(array $nodes, array $context = []): void
{
if (empty($nodes)) {
return;
}
Method createIndex
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function createIndex(Client $client, SchemaQName $qname, array $context = []): Index
{
static $created = [];
$indexName = $this->getIndexName($qname, $context);
Method getNode
has 56 lines of code (exceeds 25 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);
Method create
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function create(DynamoDbClient $client, string $tableName): void
{
try {
$client->describeTable(['TableName' => $tableName]);
return;