CornyPhoenix/fipa-sl

View on GitHub
src/CornyPhoenix/Fipa/Sl/Serializer/DefaultTupleSerializer.php

Summary

Maintainability
C
7 hrs
Test Coverage

Function unserializeContent has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    private function unserializeContent(Tuple $target, $content)
    {
        $offset = 0;
        $key = null;
        while ($offset < strlen($content)) {
Severity: Minor
Found in src/CornyPhoenix/Fipa/Sl/Serializer/DefaultTupleSerializer.php - About 3 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 unserializeContent has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function unserializeContent(Tuple $target, $content)
    {
        $offset = 0;
        $key = null;
        while ($offset < strlen($content)) {
Severity: Major
Found in src/CornyPhoenix/Fipa/Sl/Serializer/DefaultTupleSerializer.php - About 2 hrs to fix

    Method foundNestedTuple has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        private function foundNestedTuple(Term $target, $content, $startsAt, $endsAt, $key, Term $nestedTarget = null)
    Severity: Minor
    Found in src/CornyPhoenix/Fipa/Sl/Serializer/DefaultTupleSerializer.php - About 45 mins to fix

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

          public function unserialize($string, Term $target = null)
          {
              $string = trim($string);
      
              // Parse Literal terms.
      Severity: Minor
      Found in src/CornyPhoenix/Fipa/Sl/Serializer/DefaultTupleSerializer.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