laudis-technologies/neo4j-php-client

View on GitHub

Showing 24 of 35 total issues

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 LegacyHttpOGMTranslator.php has 340 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

/*
Severity: Minor
Found in src/Formatter/Specialised/LegacyHttpOGMTranslator.php - About 4 hrs to fix

File AbstractCypherSequence.php has 299 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

File Map.php has 297 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

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

Map has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class Map extends AbstractCypherSequence
{
    /**
     * @param iterable<mixed, TValue>|callable():Generator<mixed, TValue> $iterable
     *
Severity: Minor
Found in src/Types/Map.php - About 2 hrs to fix

Function getJoltBody has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getJoltBody(string $contents): stdClass
    {
        // Split json sequence in single jsons, split on json sequence separators.
        $contents = explode("\036", $contents);

Severity: Minor
Found in src/Http/HttpHelper.php - About 2 hrs 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 getJoltBody has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getJoltBody(string $contents): stdClass
    {
        // Split json sequence in single jsons, split on json sequence separators.
        $contents = explode("\036", $contents);

Severity: Major
Found in src/Http/HttpHelper.php - About 2 hrs to fix

Consider simplifying this complex logical expression.
Open

        if ($key === '' ||
            str_contains($key, '{') ||
            str_contains($key, '}') ||
            str_contains($key, '(') ||
            str_contains($key, ')') ||
Severity: Critical
Found in src/Common/Cache.php - About 1 hr to fix

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

    public function __construct($iterable = [])
    {
        if (is_array($iterable)) {
            $i = 0;
            foreach ($iterable as $key => $value) {
Severity: Minor
Found in src/Types/Map.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 translateValue has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function translateValue($value, HttpMetaInfo $meta): array
    {
        if (is_object($value)) {
            return $this->translateObject($value, $meta);
        }
Severity: Minor
Found in src/Formatter/Specialised/LegacyHttpOGMTranslator.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 translatePoint has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function translatePoint(stdClass $value): PointInterface
    {
        /** @var stdClass $crs */
        $crs = $value->crs;
        /** @var array{0: float, 1: float, 2:float} $coordinates */
Severity: Minor
Found in src/Formatter/Specialised/LegacyHttpOGMTranslator.php - About 1 hr to fix

Method translateString has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function translateString(string $value, HttpMetaInfo $meta): array
    {
        switch ($meta->getCurrentType()) {
            case 'duration':
                $meta = $meta->incrementMeta();
Severity: Minor
Found in src/Formatter/Specialised/LegacyHttpOGMTranslator.php - About 1 hr to fix

Function retry has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function retry(callable $tsxFactory, callable $tsxHandler)
    {
        while (true) {
            $transaction = null;
            try {
Severity: Minor
Found in src/Common/TransactionHelper.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 __construct has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct($iterable = [])
    {
        if (is_array($iterable)) {
            $i = 0;
            foreach ($iterable as $key => $value) {
Severity: Minor
Found in src/Types/Map.php - About 1 hr 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 translateString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function translateString(string $value, HttpMetaInfo $meta): array
    {
        switch ($meta->getCurrentType()) {
            case 'duration':
                $meta = $meta->incrementMeta();
Severity: Minor
Found in src/Formatter/Specialised/LegacyHttpOGMTranslator.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 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 convertTemporalTypes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private static function convertTemporalTypes(mixed $value, ConnectionProtocol $protocol): ?IStructure
    {
        if ($protocol->isBolt()) {
            if ($value instanceof DateTimeInterface) {
                if ($protocol->compare(ConnectionProtocol::BOLT_V44()) > 0) {
Severity: Minor
Found in src/ParameterHelper.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 getDriver has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDriver(SessionConfiguration $config, ?string $alias = null): DriverInterface
    {
        $alias ??= $this->decideAlias($alias);

        if (!array_key_exists($alias, $this->driverSetups)) {
Severity: Minor
Found in src/Common/DriverSetupManager.php - About 35 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

Severity
Category
Status
Source
Language