chdemko/php-sorted-collections

View on GitHub

Showing 69 of 69 total issues

File SubMap.php has 462 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * chdemko\SortedCollection\SubMap class
 *
Severity: Minor
Found in src/SortedCollection/SubMap.php - About 7 hrs to fix

    Function remove has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        public function remove($key, $comparator)
        {
            $cmp = call_user_func($comparator, $key, $this->key);
    
            if ($cmp < 0) {
    Severity: Minor
    Found in src/SortedCollection/TreeNode.php - About 5 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 find has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        public function find($key, $comparator, $type = 0)
        {
            $node = $this;
    
            while (true) {
    Severity: Minor
    Found in src/SortedCollection/TreeNode.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

    File TreeNode.php has 299 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * chdemko\SortedCollection\TreeNode class
     *
    Severity: Minor
    Found in src/SortedCollection/TreeNode.php - About 3 hrs to fix

      AbstractMap has 24 functions (exceeds 20 allowed). Consider refactoring.
      Open

      abstract class AbstractMap implements SortedMap
      {
          /**
           * Magic get method
           *
      Severity: Minor
      Found in src/SortedCollection/AbstractMap.php - About 2 hrs to fix

        SubMap has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class SubMap extends AbstractMap
        {
            /**
             * When the from or to key is unused
             *
        Severity: Minor
        Found in src/SortedCollection/SubMap.php - About 2 hrs to fix

          Function higher has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              public function higher($key)
              {
                  if ($this->empty) {
                      throw new \OutOfBoundsException('Higher element unexisting');
                  }
          Severity: Minor
          Found in src/SortedCollection/SubMap.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 floor has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              public function floor($key)
              {
                  if ($this->empty) {
                      throw new \OutOfBoundsException('Floor element unexisting');
                  }
          Severity: Minor
          Found in src/SortedCollection/SubMap.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 lower has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              public function lower($key)
              {
                  if ($this->empty) {
                      throw new \OutOfBoundsException('Lower element unexisting');
                  }
          Severity: Minor
          Found in src/SortedCollection/SubMap.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 ceiling has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              public function ceiling($key)
              {
                  if ($this->empty) {
                      throw new \OutOfBoundsException('Ceiling element unexisting');
                  }
          Severity: Minor
          Found in src/SortedCollection/SubMap.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 insert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function insert($key, $value, $comparator)
              {
                  $node = $this;
                  $cmp = call_user_func($comparator, $key, $this->key);
          
          
          Severity: Minor
          Found in src/SortedCollection/TreeNode.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 remove has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function remove($key, $comparator)
              {
                  $cmp = call_user_func($comparator, $key, $this->key);
          
                  if ($cmp < 0) {
          Severity: Minor
          Found in src/SortedCollection/TreeNode.php - About 1 hr to fix

            Function pullUpLeftMost has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private function pullUpLeftMost()
                {
                    if ($this->information & 2) {
                        $leftBalance = $this->left->information & ~3;
                        $this->left = $this->left->pullUpLeftMost();
            Severity: Minor
            Found in src/SortedCollection/TreeNode.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 jsonSerialize has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function jsonSerialize(): array
                {
                    if ($this->fromOption == self::UNUSED) {
                        if ($this->toOption == self::UNUSED) {
                            return array(
            Severity: Minor
            Found in src/SortedCollection/SubMap.php - About 1 hr to fix

              Method floor has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function floor($key)
                  {
                      if ($this->empty) {
                          throw new \OutOfBoundsException('Floor element unexisting');
                      }
              Severity: Minor
              Found in src/SortedCollection/SubMap.php - About 1 hr to fix

                Method ceiling has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function ceiling($key)
                    {
                        if ($this->empty) {
                            throw new \OutOfBoundsException('Ceiling element unexisting');
                        }
                Severity: Minor
                Found in src/SortedCollection/SubMap.php - About 1 hr to fix

                  Method jsonSerialize has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function jsonSerialize(): array
                      {
                          if (isset($this->from)) {
                              if (isset($this->to)) {
                                  return array(
                  Severity: Minor
                  Found in src/SortedCollection/SubSet.php - About 1 hr to fix

                    Method find has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function find($key, $comparator, $type = 0)
                        {
                            $node = $this;
                    
                            while (true) {
                    Severity: Minor
                    Found in src/SortedCollection/TreeNode.php - About 1 hr to fix

                      Method lower has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function lower($key)
                          {
                              if ($this->empty) {
                                  throw new \OutOfBoundsException('Lower element unexisting');
                              }
                      Severity: Minor
                      Found in src/SortedCollection/SubMap.php - About 1 hr to fix

                        Method higher has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function higher($key)
                            {
                                if ($this->empty) {
                                    throw new \OutOfBoundsException('Higher element unexisting');
                                }
                        Severity: Minor
                        Found in src/SortedCollection/SubMap.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language