HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

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

                    } else {
                        $y2 = 0;
                    }
Severity: Minor
Found in src/image/Image.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 _TransHor3D uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $ww = $w;
        }
Severity: Minor
Found in src/image/ImgTrans.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 _TransHor3D uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $sxt = $xt;
                }
Severity: Minor
Found in src/image/ImgTrans.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 _imageSmoothArcDrawSegment uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $xp = -1;
                        $yp = +1;
                        $xa = 0;
                        $ya = 1;
Severity: Minor
Found in src/image/Image.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(6030);
Severity: Minor
Found in src/image/LinkArrow.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 'GetImg'.
Open

            Util\JpGraphError::RaiseL(23002, $this->name); //('Mark color index too large for marker "'.($this->name).'"');
Severity: Minor
Found in src/image/ImgData.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 'SetImgFormat'.
Open

            Util\JpGraphError::RaiseL(25110, $aFormat); //(" Your PHP installation does not support the chosen graphic format: $aFormat");
Severity: Minor
Found in src/image/Image.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 'Color'.
Open

            Util\JpGraphError::RaiseL(25079, $aColor, safe_count($aColor)); //(" Unknown color specification: $aColor , size=". safe_count($aColor));
Severity: Minor
Found in src/image/RGB.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 PutAndStream uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $aImage->Stream($aStrokeFileName);
            }
Severity: Minor
Found in src/image/ImgStreamCache.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 'Allocate'.
Open

            Util\JpGraphError::RaiseL(25080); //('Alpha parameter for color must be between 0.0 and 1.0');
Severity: Minor
Found in src/image/RGB.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 'PutAndStream'.
Open

                        Util\JpGraphError::RaiseL(25112, $aCacheFileName);
Severity: Minor
Found in src/image/ImgStreamCache.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 'PutAndStream'.
Open

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

            } else {
                $error1 = 1 - $_x1 + (int) $_x1;
                $error2 = $_x2 - (int) ($_x2);
                $_x1    = $_x1 + $error1;
                $_x2    = $_x2 - $error2;
Severity: Minor
Found in src/image/Image.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 ImgData_Balls has 1051 lines of code. Current threshold is 1000. Avoid really long classes.
Open

class ImgData_Balls extends ImgData
{
    protected $name = 'Round Balls';
    protected $an   = [MARK_IMG_LBALL     => 'imgdata_large',
        MARK_IMG_MBALL                    => 'imgdata_small',
Severity: Minor
Found in src/image/ImgData_Balls.php by phpmd

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

    public function __construct()
    {
        /*
         * File: bl_red.png
         */
Severity: Minor
Found in src/image/ImgData_Balls.php by phpmd

Avoid assigning values to variables in if clauses and the like (line '169', column '13').
Open

    public function StreamImgFile($aImage, $aCacheFileName)
    {
        $aCacheFileName = $this->cache_dir . $aCacheFileName;
        if ($fh = @fopen($aCacheFileName, 'rb')) {
            $lock = flock($fh, LOCK_SH);
Severity: Minor
Found in src/image/ImgStreamCache.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

        } else {
            return false;
        }
Severity: Minor
Found in src/image/ImgStreamCache.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 'Color'.
Open

                Util\JpGraphError::RaiseL(25078, $aColor); //(" Unknown color: $aColor");
Severity: Minor
Found in src/image/RGB.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 'Set'.
Open

            Util\JpGraphError::RaiseL(6027);
Severity: Minor
Found in src/image/Progress.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 __construct() has 448 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function __construct($aImg = null)
    {
        $this->img = $aImg;

        // Conversion array between color names and RGB
Severity: Minor
Found in src/image/RGB.php by phpmd
Severity
Category
Status
Source
Language