Syndesi/neo4j-sync-bundle

View on GitHub
src/Serializer/Neo4jSerializer.php

Summary

Maintainability
D
1 day
Test Coverage
F
0%

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

    public function __construct(array $normalizers = [], array $encoders = [])
    {
        foreach ($normalizers as $normalizer) {
            if ($normalizer instanceof SerializerAwareInterface) {
                $normalizer->setSerializer($this);
Severity: Minor
Found in src/Serializer/Neo4jSerializer.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

Function getNormalizer has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function getNormalizer(mixed $data, ?string $format, array $context): ?NormalizerInterface
    {
        $type = \is_object($data) ? \get_class($data) : 'native-'.\gettype($data);

        if (!isset($this->normalizerCache[$format][$type])) {
Severity: Minor
Found in src/Serializer/Neo4jSerializer.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

Function getDenormalizer has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function getDenormalizer(mixed $data, string $class, ?string $format, array $context): ?DenormalizerInterface
    {
        if (!isset($this->denormalizerCache[$format][$class])) {
            $this->denormalizerCache[$format][$class] = [];

Severity: Minor
Found in src/Serializer/Neo4jSerializer.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

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

    public function normalize(mixed $data, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null|
        DateTimeInterface|
        DateInterval|
        Neo4j\Date|
        Neo4j\Time|
Severity: Minor
Found in src/Serializer/Neo4jSerializer.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 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct(array $normalizers = [], array $encoders = [])
    {
        foreach ($normalizers as $normalizer) {
            if ($normalizer instanceof SerializerAwareInterface) {
                $normalizer->setSerializer($this);
Severity: Minor
Found in src/Serializer/Neo4jSerializer.php - About 1 hr to fix

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

        public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
        {
            if (isset($context[DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS], $context['not_normalizable_value_exceptions'])) {
                throw new LogicException('Passing a value for "not_normalizable_value_exceptions" context key is not allowed.');
            }
    Severity: Minor
    Found in src/Serializer/Neo4jSerializer.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 denormalize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
        {
            if (isset($context[DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS], $context['not_normalizable_value_exceptions'])) {
                throw new LogicException('Passing a value for "not_normalizable_value_exceptions" context key is not allowed.');
            }
    Severity: Minor
    Found in src/Serializer/Neo4jSerializer.php - About 1 hr to fix

      Method normalize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function normalize(mixed $data, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null|
              DateTimeInterface|
              DateInterval|
              Neo4j\Date|
              Neo4j\Time|
      Severity: Minor
      Found in src/Serializer/Neo4jSerializer.php - About 1 hr to fix

        Avoid too many return statements within this method.
        Open

                    return $normalized;
        Severity: Major
        Found in src/Serializer/Neo4jSerializer.php - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status