HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

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

            } else {
                $lbl = sprintf($fmt, $this->iRanges[$idx], $this->iRanges[$idx + 1]);
                ++$idx;
            }
Severity: Minor
Found in src/plot/WindrosePlot.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 '$aYScale'.
Open

    public function Stroke($aImg, $aXScale, $aYScale)
Severity: Minor
Found in src/plot/Plot.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 PreStrokeAdjust uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $a = 0;
            $b = 0;
        }
Severity: Minor
Found in src/plot/StockPlot.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 {
                $x = $i;
            }
Severity: Minor
Found in src/plot/StockPlot.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 using static access to class '\Amenadiel\JpGraph\Util\JpGraphError' in method 'SetCompassLabels'.
Open

            Util\JpGraphError::RaiseL(22004); //('Label specification for windrose directions must have 16 values (one for each compass direction).');
Severity: Minor
Found in src/plot/WindrosePlot.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

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

    public function SetAutoScaleAngle($aIsRegRose = true)
    {
        // If the user already has manually set an angle don't
        // trye to find a position
        if (is_numeric($this->scale->iAngle)) {
Severity: Minor
Found in src/plot/WindrosePlot.php by phpmd

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

    public function Stroke($img, $x, $y)
    {
        if (!$this->show) {
            return;
        }
Severity: Minor
Found in src/plot/PlotMark.php by phpmd

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 {
                    $this->mark->Stroke($img, $pnts[$i * 2], $pnts[$i * 2 + 1]);
                }
Severity: Minor
Found in src/plot/RadarPlot.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 {
                $xt = $xscale->Translate($i);
            }
Severity: Minor
Found in src/plot/ScatterPlot.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 '$yscale'.
Open

    public function ModBox($img, $xscale, $yscale, $i, $xl, $xr, $neg)
Severity: Minor
Found in src/plot/StockPlot.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

Avoid using static access to class '\Amenadiel\JpGraph\Graph\SymChar' in method '__construct'.
Open

        $this->iLabelFormatString = '%.1f' . Graph\SymChar::Get('degree');
Severity: Minor
Found in src/plot/WindrosePlot.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

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

    public function _StrokeLegend($aImg, $x, $y, $scaling = 1, $aReturnWidth = false)
    {
        if (!$this->legend->iShow) {
            return 0;
        }
Severity: Minor
Found in src/plot/WindrosePlot.php by phpmd

Avoid unused parameters such as '$aGraph'.
Open

    public function PreScaleSetup($aGraph)
Severity: Minor
Found in src/plot/Plot.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 Min uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $x = '';
        }
Severity: Minor
Found in src/plot/Plot.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 '$aGraph'.
Open

    public function PrescaleSetup($aGraph)
Severity: Minor
Found in src/plot/PlotLine.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

Avoid using static access to class '\Amenadiel\JpGraph\Util\JpGraphError' in method 'PreStrokeAdjust'.
Open

            Util\JpGraphError::RaiseL(25123); //("JpGraph: You can't use a text X-scale with specified X-coords. Use a \"int\" or \"lin\" scale instead.");
Severity: Minor
Found in src/plot/Plot.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

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

        } else {
            $ym = '';
        }
Severity: Minor
Found in src/plot/Plot.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() has an NPath complexity of 510384. The configured NPath complexity threshold is 200.
Open

    public function Stroke($img, $x, $y)
    {
        if (!$this->show) {
            return;
        }
Severity: Minor
Found in src/plot/PlotMark.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 Stroke uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $f                                                  = $this->iFormatCallback2;
                list($width, $color, $fcolor, $filename, $imgscale) = call_user_func($f, $this->yvalue, $this->xvalue);
                if ($filename == '') {
                    $filename = $this->iFileName;
Severity: Minor
Found in src/plot/PlotMark.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 {
            $fcolor   = $this->fill_color;
            $color    = $this->color;
            $width    = $this->width;
            $filename = $this->iFileName;
Severity: Minor
Found in src/plot/PlotMark.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

Severity
Category
Status
Source
Language