chdemko/php-sorted-collections

View on GitHub

Showing 61 of 69 total issues

Function __set has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function __set($property, $value)
    {
        switch ($property) {
            case 'fromKey':
                $this->fromKey = $value;
Severity: Minor
Found in src/SortedCollection/SubMap.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 __set has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __set($property, $value)
    {
        switch ($property) {
            case 'fromKey':
                $this->fromKey = $value;
Severity: Minor
Found in src/SortedCollection/SubMap.php - About 1 hr to fix

    Method insert has 30 lines of code (exceeds 25 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 1 hr to fix

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

          public function __get($property)
          {
              switch ($property) {
                  case 'fromKey':
                      if ($this->fromOption == self::UNUSED) {
      Severity: Minor
      Found in src/SortedCollection/SubMap.php - About 1 hr to fix

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

            public function data($params)
            {
                if (isset($params['type'])) {
                    switch ($params['type']) {
                        case 'tree':
        Severity: Minor
        Found in benchmarks/TreeMapBench.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 find has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function find($key)
            {
                switch ($this->fromOption) {
                    case self::INCLUSIVE:
                        if (call_user_func($this->map->comparator(), $key, $this->fromKey) < 0) {
        Severity: Minor
        Found in src/SortedCollection/SubMap.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 data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function data($params)
            {
                if (isset($params['type'])) {
                    switch ($params['type']) {
                        case 'tree':
        Severity: Minor
        Found in benchmarks/TreeMapBench.php - About 1 hr to fix

          Function __get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __get($property)
              {
                  switch ($property) {
                      case 'fromKey':
                          if ($this->fromOption == self::UNUSED) {
          Severity: Minor
          Found in src/SortedCollection/SubMap.php - About 55 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 successor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function successor($element)
              {
                  $successor = $this->map->successor($element);
          
                  if ($successor) {
          Severity: Minor
          Found in src/SortedCollection/SubMap.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 jsonSerialize has a Cognitive Complexity of 8 (exceeds 5 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 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 jsonSerialize has a Cognitive Complexity of 8 (exceeds 5 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 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 predecessor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function predecessor($element)
              {
                  $predecessor = $this->map->predecessor($element);
          
                  if ($predecessor) {
          Severity: Minor
          Found in src/SortedCollection/SubMap.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

          Method create has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static function create(SortedMap $map, $fromKey, $toKey, $fromInclusive = true, $toInclusive = false)
          Severity: Minor
          Found in src/SortedCollection/SubMap.php - About 35 mins to fix

            Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                protected function __construct(SortedMap $map, $fromKey, $fromOption, $toKey, $toOption)
            Severity: Minor
            Found in src/SortedCollection/SubMap.php - About 35 mins to fix

              Method create has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static function create(SortedSet $set, $from, $to, $fromInclusive = true, $toInclusive = false)
              Severity: Minor
              Found in src/SortedCollection/SubSet.php - About 35 mins to fix

                Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    protected function __construct(SortedSet $set, $from, $fromOption, $to, $toOption)
                Severity: Minor
                Found in src/SortedCollection/SubSet.php - About 35 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return $this->count();
                  Severity: Major
                  Found in src/SortedCollection/TreeNode.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return null;
                    Severity: Major
                    Found in src/SortedCollection/TreeNode.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                              return null;
                      Severity: Major
                      Found in src/SortedCollection/TreeNode.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return false;
                        Severity: Major
                        Found in src/SortedCollection/SubSet.php - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language