HuasoFoundries/jpgraph

View on GitHub
src/plot/PlotLine.php

Summary

Maintainability
A
50 mins
Test Coverage

The class PlotLine has 11 public methods. Consider refactoring PlotLine to keep number of public methods under 10.
Open

class PlotLine
{
    public $scaleposition;
    public $direction            = -1;
    protected $weight            = 1;
Severity: Minor
Found in src/plot/PlotLine.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

Method _Stroke has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function _Stroke($aImg, $aMinX, $aMinY, $aMaxX, $aMaxY, $aXPos, $aYPos)
Severity: Major
Found in src/plot/PlotLine.php - About 50 mins to fix

    The method HideLegend has a boolean flag argument $f, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function HideLegend($f = true)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

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

                Util\JpGraphError::RaiseL(25125); //(" Illegal direction for static line");
    Severity: Minor
    Found in src/plot/PlotLine.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 {
                Util\JpGraphError::RaiseL(25125); //(" Illegal direction for static line");
            }
    Severity: Minor
    Found in src/plot/PlotLine.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 PreStrokeAdjust($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 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 unused parameters such as '$aImg'.
    Open

        public function StrokeMargin($aImg)
    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 variables with short names like $f. Configured minimum length is 3.
    Open

        public function HideLegend($f = true)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    Method name "PlotLine::HideLegend" is not in camel caps format
    Open

        public function HideLegend($f = true)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::Legend" is not in camel caps format
    Open

        public function Legend($aGraph)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::SetLineStyle" is not in camel caps format
    Open

        public function SetLineStyle($aStyle)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::SetColor" is not in camel caps format
    Open

        public function SetColor($aColor)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::SetDirection" is not in camel caps format
    Open

        public function SetDirection($aDir)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::Min" is not in camel caps format
    Open

        public function Min()
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::Max" is not in camel caps format
    Open

        public function Max()
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::StrokeMargin" is not in camel caps format
    Open

        public function StrokeMargin($aImg)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::SetPosition" is not in camel caps format
    Open

        public function SetPosition($aScalePosition)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::PreStrokeAdjust" is not in camel caps format
    Open

        public function PreStrokeAdjust($aGraph)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "_Stroke" should not be prefixed with an underscore to indicate visibility
    Open

        public function _Stroke($aImg, $aMinX, $aMinY, $aMaxX, $aMaxY, $aXPos, $aYPos)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::SetLegend" is not in camel caps format
    Open

        public function SetLegend($aLegend, $aCSIM = '', $aCSIMAlt = '', $aCSIMWinTarget = '')
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::SetWeight" is not in camel caps format
    Open

        public function SetWeight($aWeight)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::GetCSIMAreas" is not in camel caps format
    Open

        public function GetCSIMAreas()
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::DoLegend" is not in camel caps format
    Open

        public function DoLegend($graph)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::PrescaleSetup" is not in camel caps format
    Open

        public function PrescaleSetup($aGraph)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::Stroke" is not in camel caps format
    Open

        public function Stroke($aImg, $aXScale, $aYScale)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    Method name "PlotLine::_Stroke" is not in camel caps format
    Open

        public function _Stroke($aImg, $aMinX, $aMinY, $aMaxX, $aMaxY, $aXPos, $aYPos)
    Severity: Minor
    Found in src/plot/PlotLine.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status