laudis-technologies/neo4j-php-client

View on GitHub
src/Types/AbstractCypherSequence.php

Summary

Maintainability
C
1 day
Test Coverage

AbstractCypherSequence has 37 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AbstractCypherSequence implements Countable, JsonSerializable, ArrayAccess, Iterator
{
    /** @var list<TKey> */
    protected array $keyCache = [];
    /** @var array<TKey, TValue> */
Severity: Minor
Found in src/Types/AbstractCypherSequence.php - About 4 hrs to fix

File AbstractCypherSequence.php has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

/*
Severity: Minor
Found in src/Types/AbstractCypherSequence.php - About 3 hrs to fix

Consider simplifying this complex logical expression.
Open

                if (((is_array($value) && array_key_exists($key, $value)) || ($value instanceof ArrayAccess && $value->offsetExists($key))) && $this->isStringable($value[$key])) {
                    yield $value[$key] => $value;
                } elseif (is_object($value) && property_exists($value, $key) && $this->isStringable($value->$key)) {
                    yield $value->$key => $value;
                } else {
Severity: Major
Found in src/Types/AbstractCypherSequence.php - About 1 hr to fix

Function pluck has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function pluck(string $key): ArrayList
    {
        return new ArrayList(function () use ($key) {
            foreach ($this as $value) {
                if ((is_array($value) && array_key_exists($key, $value)) || ($value instanceof ArrayAccess && $value->offsetExists($key))) {
Severity: Minor
Found in src/Types/AbstractCypherSequence.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

Function keyBy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function keyBy(string $key): Map
    {
        return new Map(function () use ($key) {
            foreach ($this as $value) {
                if (((is_array($value) && array_key_exists($key, $value)) || ($value instanceof ArrayAccess && $value->offsetExists($key))) && $this->isStringable($value[$key])) {
Severity: Minor
Found in src/Types/AbstractCypherSequence.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

Function next has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function next(): void
    {
        $generator = $this->getGenerator();
        if ($this->cache === []) {
            $this->setupCache();
Severity: Minor
Found in src/Types/AbstractCypherSequence.php - About 25 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

There are no issues that match your filters.

Category
Status