HuasoFoundries/jpgraph

View on GitHub
src/graph/AxisPrototype.php

Summary

Maintainability
A
3 hrs
Test Coverage

AxisPrototype has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

class AxisPrototype
{
    public $scale;
    public $img;
    public $hide        = false;
Severity: Minor
Found in src/graph/AxisPrototype.php - About 3 hrs to fix

    The class AxisPrototype has 29 fields. Consider redesigning AxisPrototype to keep the number of fields under 15.
    Open

    class AxisPrototype
    {
        public $scale;
        public $img;
        public $hide        = false;
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpmd

    TooManyFields

    Since: 0.1

    Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

    Example

    class Person {
       protected $one;
       private $two;
       private $three;
       [... many more fields ...]
    }

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

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

        public function SetColor($aColor, $aLabelColor = false)
    Severity: Minor
    Found in src/graph/AxisPrototype.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

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

        public function SetLabelFormatString($aFormStr, $aDate = false)
    Severity: Minor
    Found in src/graph/AxisPrototype.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

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

        public function HideLabels($aHide = true)
    Severity: Minor
    Found in src/graph/AxisPrototype.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

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

        public function Hide($aHide = true)
    Severity: Minor
    Found in src/graph/AxisPrototype.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

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

        public function HideLine($aHide = true)
    Severity: Minor
    Found in src/graph/AxisPrototype.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

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

        public function HideLastTickLabel($aShow = false)
    Severity: Minor
    Found in src/graph/AxisPrototype.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

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

        public function HideFirstTickLabel($aShow = false)
    Severity: Minor
    Found in src/graph/AxisPrototype.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

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

        public function HideTicks($aHideMinor = true, $aHideMajor = true)
    Severity: Minor
    Found in src/graph/AxisPrototype.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

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

        public function HideZeroLabel($aFlag = true)
    Severity: Minor
    Found in src/graph/AxisPrototype.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

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

        public function HideTicks($aHideMinor = true, $aHideMajor = true)
    Severity: Minor
    Found in src/graph/AxisPrototype.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

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

            } else {
                $this->title_margin = 5;
                $this->title_adjust = 'high';
                $this->title->SetOrientation(0);
                $this->tick_label_margin = 5;
    Severity: Minor
    Found in src/graph/AxisPrototype.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 SetColor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $this->label_color = $aLabelColor;
            }
    Severity: Minor
    Found in src/graph/AxisPrototype.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 '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 unused parameters such as '$aFlag'.
    Open

        public function HideZeroLabel($aFlag = true)
    Severity: Minor
    Found in src/graph/AxisPrototype.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

    Method name "AxisPrototype::HideLabels" is not in camel caps format
    Open

        public function HideLabels($aHide = true)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetTickSide" is not in camel caps format
    Open

        public function SetTickSide($aDir)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetTextLabelInterval" is not in camel caps format
    Open

        public function SetTextLabelInterval($aStep)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetTickPositions" is not in camel caps format
    Open

        public function SetTickPositions($aMajPos, $aMinPos = null, $aLabels = null)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetTickLabels" is not in camel caps format
    Open

        public function SetTickLabels($aLabelArray, $aLabelColorArray = null)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetPos" is not in camel caps format
    Open

        public function SetPos($aPosOnOtherScale)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetLabelFormat" is not in camel caps format
    Open

        public function SetLabelFormat($aFormStr)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::HideFirstLastLabel" is not in camel caps format
    Open

        public function HideFirstLastLabel()
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetTickSize" is not in camel caps format
    Open

        public function SetTickSize($aMajSize, $aMinSize = 3)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetLabelMargin" is not in camel caps format
    Open

        public function SetLabelMargin($aMargin)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::HideLastTickLabel" is not in camel caps format
    Open

        public function HideLastTickLabel($aShow = false)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetTitle" is not in camel caps format
    Open

        public function SetTitle($aTitle, $aAdjustAlign = 'high')
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetMajTickPositions" is not in camel caps format
    Open

        public function SetMajTickPositions($aMajPos, $aLabels = null)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

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

        public function SetColor($aColor, $aLabelColor = false)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetLabelAlign" is not in camel caps format
    Open

        public function SetLabelAlign($aHAlign, $aVAlign = 'top', $aParagraphAlign = 'left')
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetLabelAngle" is not in camel caps format
    Open

        public function SetLabelAngle($aAngle)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::Hide" is not in camel caps format
    Open

        public function Hide($aHide = true)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetLabelFormatString" is not in camel caps format
    Open

        public function SetLabelFormatString($aFormStr, $aDate = false)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetTitleMargin" is not in camel caps format
    Open

        public function SetTitleMargin($aMargin)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetPosAbsDelta" is not in camel caps format
    Open

        public function SetPosAbsDelta($aDelta)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

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

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

    Method name "AxisPrototype::SetLabelSide" is not in camel caps format
    Open

        public function SetLabelSide($aSidePos)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetLabelFormatCallback" is not in camel caps format
    Open

        public function SetLabelFormatCallback($aFuncName)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::HideTicks" is not in camel caps format
    Open

        public function HideTicks($aHideMinor = true, $aHideMajor = true)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetTextTickInterval" is not in camel caps format
    Open

        public function SetTextTickInterval($aStep, $aStart = 0)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetFont" is not in camel caps format
    Open

        public function SetFont($aFamily, $aStyle = FS_NORMAL, $aSize = 10)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::HideFirstTickLabel" is not in camel caps format
    Open

        public function HideFirstTickLabel($aShow = false)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::HideZeroLabel" is not in camel caps format
    Open

        public function HideZeroLabel($aFlag = true)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::HideLine" is not in camel caps format
    Open

        public function HideLine($aHide = true)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    Method name "AxisPrototype::SetTitleSide" is not in camel caps format
    Open

        public function SetTitleSide($aSideOfAxis)
    Severity: Minor
    Found in src/graph/AxisPrototype.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status