CornyPhoenix/fipa-sl

View on GitHub

Showing 7 of 7 total issues

AbstractTuple has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AbstractTuple implements LiteralTuple
{

    /**
     * @var string
Severity: Minor
Found in src/CornyPhoenix/Fipa/Sl/AbstractTuple.php - About 3 hrs to fix

    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

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

          public function findEndOfString($string, $offset)
          {
              $quoted = $string[$offset] === $this->getStringDelimiter();
      
              if ($quoted) {
      Severity: Minor
      Found in src/CornyPhoenix/Fipa/Sl/Context/DefaultTupleContext.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 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

        Avoid too many return statements within this method.
        Open

                return strval($this->value);
        Severity: Major
        Found in src/CornyPhoenix/Fipa/Sl/LiteralTerm.php - About 30 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

          Severity
          Category
          Status
          Source
          Language