The class Node has an overall complexity of 56 which is very high. The configured complexity threshold is 50.
class Node
{
public $root;
/**
* @var Interval
The class Node has 13 public methods. Consider refactoring Node to keep number of public methods under 10.
class Node
{
public $root;
/**
* @var Interval
Function remove
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
public function remove(IntervalInterface $i)
{
if ($this->max > $i->getEnd()) {
if ($this->left) {
$this->left->add($i);
Function add
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
public function add(IntervalInterface $i)
{
if ($this->max > $i->getEnd()) {
if ($this->left) {
$this->left->add($i);
Function yieldInterSelectNode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
public function yieldInterSelectNode(int $low, int $high)
{
$edgeR = $high >= $this->interval->getStart() && $high <= $this->interval->getEnd();
$edgeL = $low >= $this->interval->getStart() && $low <= $this->interval->getEnd();
$part = $this->interval->getStart() >= $low && $this->interval->getEnd() <= $high;
Function yieldInterSelect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
public function yieldInterSelect(int $low, int $high)
{
$edgeR = $high >= $this->interval->getStart() && $high <= $this->interval->getEnd();
$edgeL = $low >= $this->interval->getStart() && $low <= $this->interval->getEnd();
$part = $this->interval->getStart() >= $low && $this->interval->getEnd() <= $high;
The method yieldInterSelectNode() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
public function yieldInterSelectNode(int $low, int $high)
{
$edgeR = $high >= $this->interval->getStart() && $high <= $this->interval->getEnd();
$edgeL = $low >= $this->interval->getStart() && $low <= $this->interval->getEnd();
$part = $this->interval->getStart() >= $low && $this->interval->getEnd() <= $high;
The method yieldInterSelect() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
public function yieldInterSelect(int $low, int $high)
{
$edgeR = $high >= $this->interval->getStart() && $high <= $this->interval->getEnd();
$edgeL = $low >= $this->interval->getStart() && $low <= $this->interval->getEnd();
$part = $this->interval->getStart() >= $low && $this->interval->getEnd() <= $high;
The method remove uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$this->left = new self($i);
}
The method add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$this->left = new self($i);
$this->left->root = &$this;
}
The method remove uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$this->max = $i->getEnd();
if ($this->right) {
$this->right->add($i);
} else {
The method add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$this->max = $i->getEnd();
if ($this->right) {
$this->right->add($i);
} else {
The method add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$this->right = new self($i);
$this->right->root = &$this;
}
The method remove uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$this->right = new self($i);
}
Identical blocks of code found in 2 locations. Consider refactoring.
if ($this->max > $i->getEnd()) {
if ($this->left) {
$this->left->add($i);
} else {
$this->left = new self($i);
Avoid variables with short names like $i. Configured minimum length is 3.
public function remove(IntervalInterface $i)
Avoid variables with short names like $i. Configured minimum length is 3.
public function add(IntervalInterface $i)
There are no issues that match your filters.