HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

The method AdjDate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                ++$y;
                $y = ceil($y / $yearAdj[$aYearType]) * $yearAdj[$aYearType];
            }
Severity: Minor
Found in src/graph/DateScale.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method AdjTime uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                if (($h % $hourAdj[$aHourType] == 0) && ($i > 0 || $s > 0)) {
                    ++$h;
                }
                $h = ceil($h / $hourAdj[$aHourType]) * $hourAdj[$aHourType];
Severity: Minor
Found in src/graph/DateScale.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method DoDateAutoScale uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            $start = $this->AdjStartTime($aStartTime, false, false, $adj);
                            $end   = $this->AdjEndTime($aEndTime, false, false, $adj);
                        }
Severity: Minor
Found in src/graph/DateScale.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method StrokeLabels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->img->SetColor($this->label_color);
        }
Severity: Minor
Found in src/graph/Axis.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method StrokeLabels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                            } else {
                                $this->img->SetTextAlign($this->label_halign, $this->label_valign);
                            }
Severity: Minor
Found in src/graph/Axis.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method DoDateAutoScale uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        // Use time adjustment
                        $adj = $scaleSteps[2][$idx + 1];
                        if ($adj >= 30) {
                            $start = $this->AdjStartTime($aStartTime, $adj - 30);
Severity: Minor
Found in src/graph/DateScale.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method Stroke uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                Util\JpGraphError::RaiseL(25061, $this->title_adjust); //('Unknown alignment specified for Y-axis title. ('.$this->title_adjust.')');
            }
Severity: Minor
Found in src/graph/Axis.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method StrokeLabels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    // scale->type == "y"
                    //if( $this->label_angle!=0 )
                    //Util\JpGraphError::Raise(" Labels at an angle are not supported on Y-axis");
                    if ($this->labelPos == SIDE_LEFT) {
Severity: Minor
Found in src/graph/Axis.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method StrokeLabels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                            } else {
                                $this->img->SetTextAlign($this->label_halign, $this->label_valign);
                            }
Severity: Minor
Found in src/graph/Axis.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method AdjDate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    --$w;
                }
Severity: Minor
Found in src/graph/DateScale.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method AdjTime uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $s = ceil($s / $secAdj[$aSecType] * 1.0) * $secAdj[$aSecType];
                if ($s >= 60) {
                    $s = 0;
                    $aTime += 60;
Severity: Minor
Found in src/graph/DateScale.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid unused parameters such as '$_adummy'.
Open

    public function AutoScale($img, $aStartTime, $aEndTime, $aNumSteps, $_adummy = false)
Severity: Minor
Found in src/graph/DateScale.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

The method AdjTime uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                if (($i % $minAdj[$aMinType] == 0) && $s > 0) {
                    ++$i;
                }
                $i = ceil($i / $minAdj[$aMinType]) * $minAdj[$aMinType];
Severity: Minor
Found in src/graph/DateScale.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method DoDateAutoScale() has 144 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function DoDateAutoScale($aStartTime, $aEndTime, $aDensity = 0, $aAdjust = true)
    {
        // Format of array
        // array ( Decision point,  array( array( Major-scale-step-array ),
        //       array( Minor-scale-step-array ),
Severity: Minor
Found in src/graph/DateScale.php by phpmd

The method AutoScale() has an NPath complexity of 24576. The configured NPath complexity threshold is 200.
Open

    public function AutoScale($img, $aStartTime, $aEndTime, $aNumSteps, $_adummy = false)
    {
        // We need to have one dummy argument to make the signature of AutoScale()
        // identical to LinearScale::AutoScale
        if ($aStartTime == $aEndTime) {
Severity: Minor
Found in src/graph/DateScale.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method AutoScale uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->ticks->SetLabelDateFormat($this->date_format);
        }
Severity: Minor
Found in src/graph/DateScale.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid unused parameters such as '$aMinor'.
Open

    public function StrokeLabels($aPos, $aMinor = false, $aAbsLabel = false)
Severity: Minor
Found in src/graph/Axis.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

The method StrokeLabels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $label = $this->scale->ticks->maj_ticks_label[$i];
                    }
Severity: Minor
Found in src/graph/Axis.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method SetColorIndication uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                Util\JpGraphError::Raise('Color specification for background indication must have four colors.');
            }
Severity: Minor
Found in src/graph/CCBPGraph.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method Init() has 136 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    private function Init()
    {
        // Setup limits for color indications
        $lowx   = $this->iXMin;
        $highx  = $this->iXMax;
Severity: Minor
Found in src/graph/CCBPGraph.php by phpmd
Severity
Category
Status
Source
Language