HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

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

        Util\JpGraphError::RaiseL('25132', $name);
Severity: Minor
Found in src/graph/LinearScale.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 _doLabelFormat uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                if ($this->label_dateformatstr !== '') {
                    // Adjust the value to take daylight savings into account
                    if (date('I', $aVal) == 1 && $this->iAdjustForDST) {
                        // DST
Severity: Minor
Found in src/graph/LinearTicks.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 _doLabelFormat uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            //FIX: if negative precision  is returned "0f" , instead of formatted values
            $format = $precision > 0 ? '%01.' . $precision . 'f' : '%01.0f';
            $l      = sprintf($format, round($aVal, $precision));
        }
Severity: Minor
Found in src/graph/LinearTicks.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 _StrokeTicks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    //if( $this->maj_ticks_pos[$i] >= $limit )
                    $aImg->Line($aPos, $this->maj_ticks_pos[$i], $xr, $this->maj_ticks_pos[$i]);
                }
Severity: Minor
Found in src/graph/LinearTicks.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 SetXLabelOffset uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->xtick_offset = $aTickOff;
        }
Severity: Minor
Found in src/graph/LinearTicks.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 __construct() contains an exit expression.
Open

                exit();
Severity: Minor
Found in src/graph/MGraph.php by phpmd

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

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

                    } else {
                        $ha = 'left';
                        $va = 'center';
                    }
Severity: Minor
Found in src/graph/PolarAxis.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 373 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function Stroke($img, $xscale, $yscale)
    {
        $numpoints = safe_count($this->coords[0]);
        if (isset($this->coords[1])) {
            if (safe_count($this->coords[1]) != $numpoints) {
Severity: Minor
Found in src/plot/BarPlot.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->PushColor($this->bar_shadow_color);
                }
Severity: Minor
Found in src/plot/BarPlot.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 uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $p1 = $this->RotatePattern($this->iPattern, $graph->img->a == 90);
                $p2 = $this->iPatternColor;
                $p3 = $this->iPatternDensity;
            }
Severity: Minor
Found in src/plot/BarPlot.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 '_SetPatternHelper'.
Open

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

                } else {
                    if ($val < 0) {
                        $this->value->SetMargin(-5);
                        $y = $pts[1];
                        $this->value->SetAlign('center', 'bottom');
Severity: Minor
Found in src/plot/BarPlot.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 {
                        $this->value->SetAlign('center', 'bottom');
                    }
Severity: Minor
Found in src/plot/BarPlot.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(2003, safe_count($this->coords[1]), $numpoints);
Severity: Minor
Found in src/plot/ErrorPlot.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 283500. The configured NPath complexity threshold is 200.
Open

    public function Stroke($aImg, $aScale)
    {
        $factory = new Graph\RectPatternFactory();
        $prect   = $factory->Create($this->iPattern, $this->iPatternColor);
        $prect->SetDensity($this->iPatternDensity);
Severity: Minor
Found in src/plot/GanttBar.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 {
            $y1 = $aScale->iVertHeaderSize + $aImg->top_margin;
        }
Severity: Minor
Found in src/plot/GanttVLine.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 FilledRectangle uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    // height is greater than width -> use y-dimension for steps
                    $steps = $yb - $yt;
                    $delta = $yb >= $yt ? 1 : -1;
                    $this->GetColArray($from_color, $to_color, $steps * 2, $colors, $this->numcolors);
Severity: Minor
Found in src/plot/Gradient.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 {
            $exist_x = false;
        }
Severity: Minor
Found in src/plot/BarPlot.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 {
                        $rx = $pts[2];
                        $ry = $pts[3];
                    }
Severity: Minor
Found in src/plot/BarPlot.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(2004, $i, $val);
Severity: Minor
Found in src/plot/BarPlot.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

Severity
Category
Status
Source
Language