HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

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

        } else {
            $this->iPlots[] = $aPlots;
        }
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 StrokeLabels() has an NPath complexity of 26016. The configured NPath complexity threshold is 200.
Open

    public function StrokeLabels($aPos, $aMinor = false, $aAbsLabel = false)
    {
        if (is_array($this->label_color) && safe_count($this->label_color) > 3) {
            $this->ticks_label_colors = $this->label_color;
            $this->img->SetColor($this->label_color[0]);
Severity: Minor
Found in src/graph/Axis.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 using static access to class '\Amenadiel\JpGraph\Util\JpGraphError' in method 'SetTextLabelInterval'.
Open

            Util\JpGraphError::RaiseL(25058); //(" Text label interval must be specified >= 1.");
Severity: Minor
Found in src/graph/AxisPrototype.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

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

                Util\JpGraphError::Raise('Color specification for background indication must have four colors.');
Severity: Minor
Found in src/graph/CCBPGraph.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 Init uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $graph->xaxis->SetColor('darkgray', 'darkgray:0.8');
            $graph->yaxis->SetColor('darkgray', 'darkgray:0.8');
        }
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 Stroke uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $x += $this->title_margin;
                $x += $this->title->margin;
                $halign = '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 Init uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $labelsize = 11;
        }
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 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->AdjStartDate($aStartTime, false, false, $adj);
                            $end   = $this->AdjEndDate($aEndTime, false, false, $adj);
                            // We add 1 second for date adjustment to make sure we end on 00:00 the following day
                            // This makes the final major tick be srawn when we step day-by-day instead of ending
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 AutoScale uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $adjend = $this->AdjEndDate($aEndTime, false, false, $this->iEndAlign);
            }
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 '$aXMax'.
Open

    public function SetScale($aAxisType, $aYMin = 1, $aYMax = 1, $aXMin = 1, $aXMax = 1)
Severity: Minor
Found in src/graph/GanttGraph.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 AutoSize() has 287 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function AutoSize()
    {
        if ($this->img->img == null) {
            // The predefined left, right, top, bottom margins.
            // Note that the top margin might incease depending on
Severity: Minor
Found in src/graph/GanttGraph.php by phpmd

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

            } else {
                $fw = 2;
            }
Severity: Minor
Found in src/graph/GanttGraph.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 112 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function Stroke($aStrokeFileName = '')
    {
        // If the filename is the predefined value = '_csim_special_'
        // we assume that the call to stroke only needs to do enough
        // to correctly generate the CSIM maps.
Severity: Minor
Found in src/graph/GanttGraph.php by phpmd

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

                        Util\JpGraphError::RaiseL(6008, $this->iObj[$i]->iVPos, $vpos);
Severity: Minor
Found in src/graph/GanttGraph.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 StrokeConstrains uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                                } else {
                                    $link = new Image\GanttLink($c1[2], $c1[1], $c2[0], $c2[3]);
                                }
Severity: Minor
Found in src/graph/GanttGraph.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 StrokeConstrains uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                                } else {
                                    $link = new Image\GanttLink($c1[0], $c1[1], $c2[0], $c2[3]);
                                }
Severity: Minor
Found in src/graph/GanttGraph.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 '__construct'.
Open

            Util\JpGraphError::RaiseL(6002);
Severity: Minor
Found in src/graph/GanttGraph.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

Avoid unused local variables such as '$yoff'.
Open

        $yoff = $this->img->GetFontHeight() / 2;
Severity: Minor
Found in src/graph/Axis.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

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

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

                    } else {
                        $m = max($m, $this->iObj[$i]->title->GetWidth($this->img));
                    }
Severity: Minor
Found in src/graph/GanttGraph.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 AutoSize() has an NPath complexity of 359326801. The configured NPath complexity threshold is 200.
Open

    public function AutoSize()
    {
        if ($this->img->img == null) {
            // The predefined left, right, top, bottom margins.
            // Note that the top margin might incease depending on
Severity: Minor
Found in src/graph/GanttGraph.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

Severity
Category
Status
Source
Language