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();
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);
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;
}
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)) {
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)) {
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 [];
}
- 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 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];
}
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];
- 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 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(),
- 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 getItems
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getItems(): array
{
$allItems = [];
while ($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 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]."
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];
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 = [
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);
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;
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);
- 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 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);
- 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 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);
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]."
- 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 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);
- 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"