HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

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

            } else {
                $l   = sprintf($l, $this->adjusted_data[$i]);
                $alt = sprintf($fmt, $this->adjusted_data[$i]);
            }
Severity: Minor
Found in src/plot/PiePlot.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 'Stroke'.
Open

            Util\JpGraphError::RaiseL(15009); //("Sum of all data is 0 for Pie.");
Severity: Minor
Found in src/plot/PiePlot.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 StrokeGuideLabels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            // Create a "cluster" of one
            ++$cidx;
            $clusters[$cidx][0] = $i;
            $clusters[$cidx][1] = 1;
Severity: Minor
Found in src/plot/PiePlot.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 StrokeGuideLabels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    // Create a "cluster" of one since we are just crossing
                    // a quadrant
                    ++$cidx;
                    $clusters[$cidx][0] = $i;
Severity: Minor
Found in src/plot/PiePlot.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 class PiePlot3D has 1051 lines of code. Current threshold is 1000. Avoid really long classes.
Open

class PiePlot3D extends PiePlot
{
    private $labelhintcolor = 'red';
    private $showlabelhint  = true;
    private $angle          = 50;
Severity: Minor
Found in src/plot/PiePlot3D.php by phpmd

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

            Util\JpGraphError::RaiseL(14002);
Severity: Minor
Found in src/plot/PiePlot3D.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 Add3DSliceToCSIM uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $yp = floor($yc - $height * sin($a) / 2);
            }
Severity: Minor
Found in src/plot/PiePlot3D.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 269 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function Stroke($img, $xscale, $yscale)
    {
        $idx       = 0;
        $numpoints = safe_count($this->coords[0]);
        if (isset($this->coords[1])) {
Severity: Minor
Found in src/plot/LinePlot.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 {
                    $img->Polygon($cord);
                }
Severity: Minor
Found in src/plot/LinePlot.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 Legend() has an NPath complexity of 1000. The configured NPath complexity threshold is 200.
Open

    public function Legend($graph)
    {
        $colors = array_keys($graph->img->rgb->rgb_table);
        sort($colors);
        $ta = $this->themearr[$this->theme];
Severity: Minor
Found in src/plot/PiePlot.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 StrokeGuideLabels() has an NPath complexity of 87048. The configured NPath complexity threshold is 200.
Open

    public function StrokeGuideLabels($img, $xc, $yc, $radius)
    {
        $n = safe_count($this->labels);

        /**
Severity: Minor
Found in src/plot/PiePlot.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 Pie3DSlice() has 201 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function Pie3DSlice($img, $xc, $yc, $w, $h, $sa, $ea, $z, $fillcolor, $shadow = 0.65)
    {
        // Due to the way the 3D Pie algorithm works we are
        // guaranteed that any slice we get into this method
        // belongs to either the left or right side of the
Severity: Minor
Found in src/plot/PiePlot3D.php by phpmd

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

            } else {
                // $sa >= 90 && $ea <= 180
                $p = [$xc, $yc, $xc, $yc + $z,
                    $xc + $w * $cosea, $z + $yc - $h * $sinea,
                    $xc + $w * $cosea, $yc - $h * $sinea,
Severity: Minor
Found in src/plot/PiePlot3D.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 Pie3D() has an NPath complexity of 14494464000. The configured NPath complexity threshold is 200.
Open

    public function Pie3D(
        $aaoption,
        $img,
        $data,
        $colors,
Severity: Minor
Found in src/plot/PiePlot3D.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 Pie3D uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    // no split
                    $angles[$idx]     = [$a, $ne];
                    $adjcolors[$idx]  = $colors[$i % $numcolors];
                    $adjexplode[$idx] = $explode;
Severity: Minor
Found in src/plot/PiePlot3D.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 'Pie3D'.
Open

                Util\JpGraphError::RaiseL(14005);
Severity: Minor
Found in src/plot/PiePlot3D.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 Stroke() has an NPath complexity of 20412. The configured NPath complexity threshold is 200.
Open

    public function Stroke($img, $aaoption = 0)
    {
        $n = safe_count($this->data);

        // If user hasn't set the colors use the theme array
Severity: Minor
Found in src/plot/PiePlot3D.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 {
            $thick = $width / 12;
        }
Severity: Minor
Found in src/plot/PiePlot3D.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() has an NPath complexity of 52488. The configured NPath complexity threshold is 200.
Open

    public function StrokeLabels($label, $img, $a, $xp, $yp, $z)
    {
        $this->value->halign = 'left';
        $this->value->valign = 'top';

Severity: Minor
Found in src/plot/PiePlot3D.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

Avoid unused parameters such as '$aCenterTitle'.
Open

    public function __construct($data, $aCenterTitle = '')
Severity: Minor
Found in src/plot/PiePlotC.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

Severity
Category
Status
Source
Language