Showing 72 of 92 total issues
Method getItems
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getItems(): array
{
$allItems = [];
while ($this->queue) {
Method getSubscribedEvents
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getSubscribedEvents(): array
{
return [
'gdbots:ncr:event:node-created' => 'onNodeCreated',
'gdbots:ncr:event:node-deleted' => 'onNodeDeleted',
Method ensureSlugIsAvailable
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function ensureSlugIsAvailable(PbjxEvent $pbjxEvent, NodeRef $nodeRef, string $slug): void
{
$pbjx = $pbjxEvent::getPbjx();
$command = $pbjxEvent->getMessage();
Function getNodes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getNodes(array $nodeRefs, bool $consistent = false, array $context = []): array
{
$context = $this->enrichContext(__FUNCTION__, $context);
if (empty($nodeRefs)) {
- 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 putNode
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function putNode(Message $node, ?string $expectedEtag = null, array $context = []): void
{
$node->freeze();
$nodeRef = $node->generateNodeRef();
- 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 prepareCommands
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function prepareCommands(): array
{
$batches = array_chunk($this->queue, $this->batchSize);
$this->queue = [];
- 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 addEmbeddedNodeRefs
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addEmbeddedNodeRefs(array $messages, array $paths): void
{
$nodeRefs = [];
if (array_is_list($paths)) {
Method addEmbeddedNodeRefs
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addEmbeddedNodeRefs(array $messages, array $paths, string $namespace = self::DEFAULT_NAMESPACE): void
{
$nodeRefs = [];
if (array_is_list($paths)) {
Method getNode
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getNode(PbjxEvent $pbjxEvent): Message
{
$command = $pbjxEvent->getMessage();
Assertion::true($command->has('node_ref'), 'Field "node_ref" is required.', 'node_ref');
Function deleteNode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function deleteNode(NodeRef $nodeRef, array $context = []): void
{
$context = $this->enrichContext(__FUNCTION__, $context);
$tableName = $this->tableManager->getNodeTableName($nodeRef->getQName(), $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
Function hasNode
has a Cognitive Complexity of 9 (exceeds 5 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);
- 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 hasNode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
final public function hasNode(NodeRef $nodeRef, bool $consistent = false, array $context = []): bool
{
if (!$consistent) {
$cacheKey = $this->getCacheKey($nodeRef, $context);
$cacheItem = $this->cache->getItem($cacheKey);
- 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 lockNode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function lockNode(Message $command): void
{
if (!$this->node::schema()->hasMixin('gdbots:ncr:mixin:lockable')) {
throw new InvalidArgumentException(
"Node [{$this->nodeRef}] must have [gdbots:ncr:mixin:lockable]."
- 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 __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
SchemaQName $qname,
string $alias,
string $value,
int $count = 25,
?string $cursor = null,
Function getNode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getNode(NodeRef $nodeRef): Message
{
if (!$this->hasNode($nodeRef)) {
if ($this->lazyLoader->hasNodeRef($nodeRef)) {
$this->disablePruning = true;
- 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 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];
}
- 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 searchNodes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function searchNodes(Message $request, ParsedQuery $parsedQuery, Message $response, array $qnames = [], array $context = []): void;
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
DynamoDbClient $client,
EventDispatcher $dispatcher,
TableManager $tableManager,
array $config = [],
?LoggerInterface $logger = null
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ClientManager $clientManager,
EventDispatcher $dispatcher,
IndexManager $indexManager,
?LoggerInterface $logger = null,
?string $timeout = null
Method searchNodes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function searchNodes(Message $request, ParsedQuery $parsedQuery, Message $response, array $qnames = [], array $context = []): void