MartanLV/koki

View on GitHub

Showing 40 of 40 total issues

The class Node has an overall complexity of 56 which is very high. The configured complexity threshold is 50.
Open

class Node
{
public $root;
/**
* @var Interval
Severity: Minor
Found in src/Node.php by phpmd

The class Tree has 15 public methods. Consider refactoring Tree to keep number of public methods under 10.
Open

class Tree extends Node
{
public $root;
 
/**
Severity: Minor
Found in src/Tree.php by phpmd

The class Node has 13 public methods. Consider refactoring Node to keep number of public methods under 10.
Open

class Node
{
public $root;
/**
* @var Interval
Severity: Minor
Found in src/Node.php by phpmd

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

public function remove(IntervalInterface $i)
{
if (!$i->left && !$i->right) {
if ($i->root) {
$i->root = null;
Severity: Minor
Found in src/Tree.php - About 2 hrs to fix

Method remove has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function remove(IntervalInterface $i)
{
if (!$i->left && !$i->right) {
if ($i->root) {
$i->root = null;
Severity: Minor
Found in src/Tree.php - About 1 hr to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    if ($this->max > $i->getEnd()) {
    if ($this->left) {
    $this->left->add($i);
    } else {
    $this->left = new self($i);
    Severity: Major
    Found in src/Node.php and 1 other location - About 1 hr to fix
    src/Tree.php on lines 177..190

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    if ($this->max > $i->getEnd()) {
    if ($this->left) {
    $this->left->add($i);
    } else {
    $this->left = new Node($i);
    Severity: Major
    Found in src/Tree.php and 1 other location - About 1 hr to fix
    src/Node.php on lines 214..227

    Avoid variables with short names like $i. Configured minimum length is 3.
    Open

    public function remove(IntervalInterface $i)
    Severity: Minor
    Found in src/Node.php by phpmd

    Avoid variables with short names like $i. Configured minimum length is 3.
    Open

    usort($arr, function (IntervalInterface $i0, IntervalInterface $i) {
    Severity: Minor
    Found in src/Tree.php by phpmd

    Avoid variables with short names like $i. Configured minimum length is 3.
    Open

    public function add(IntervalInterface $i)
    Severity: Minor
    Found in src/Node.php by phpmd

    Avoid variables with short names like $i. Configured minimum length is 3.
    Open

    !$preSorted && usort($intervals, function (IntervalInterface $i0, IntervalInterface $i) {
    Severity: Minor
    Found in src/Tree.php by phpmd

    Avoid variables with short names like $i0. Configured minimum length is 3.
    Open

    !$preSorted && usort($intervals, function (IntervalInterface $i0, IntervalInterface $i) {
    Severity: Minor
    Found in src/Tree.php by phpmd

    Avoid variables with short names like $i. Configured minimum length is 3.
    Open

    public function remove(IntervalInterface $i)
    Severity: Minor
    Found in src/Tree.php by phpmd

    Avoid variables with short names like $i. Configured minimum length is 3.
    Open

    public function add(IntervalInterface $i)
    Severity: Minor
    Found in src/Tree.php by phpmd

    Avoid variables with short names like $i0. Configured minimum length is 3.
    Open

    usort($arr, function (IntervalInterface $i0, IntervalInterface $i) {
    Severity: Minor
    Found in src/Tree.php by phpmd

    Avoid variables with short names like $el. Configured minimum length is 3.
    Open

    array_walk($intervals, function (IntervalInterface $el) use (&$max) {
    Severity: Minor
    Found in src/Tree.php by phpmd

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

    public function remove(IntervalInterface $i)
    {
    if ($this->max > $i->getEnd()) {
    if ($this->left) {
    $this->left->add($i);
    Severity: Minor
    Found in src/Node.php - About 45 mins to fix

    Function add has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    public function add(IntervalInterface $i)
    {
    if ($this->max > $i->getEnd()) {
    if ($this->left) {
    $this->left->add($i);
    Severity: Minor
    Found in src/Node.php - About 45 mins to fix

    Function yieldInterSelectNode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    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;
    Severity: Minor
    Found in src/Node.php - About 35 mins to fix

    The method __construct has a boolean flag argument $preSorted, which is a certain sign of a Single Responsibility Principle violation.
    Open

    public function __construct(array $intervals = [], bool $preSorted = false)
    Severity: Minor
    Found in src/Tree.php by phpmd
    Severity
    Category
    Status
    Source
    Language