steeffeen/FancyManiaLinks

View on GitHub
FML/Controls/Gauge.php

Summary

Maintainability
A
1 hr
Test Coverage
A
100%

Method render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function render(\DOMDocument $domDocument)
    {
        $domElement = parent::render($domDocument);
        if ($this->ratio) {
            $domElement->setAttribute("ratio", $this->ratio);
Severity: Minor
Found in FML/Controls/Gauge.php - About 1 hr to fix

    Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function render(\DOMDocument $domDocument)
        {
            $domElement = parent::render($domDocument);
            if ($this->ratio) {
                $domElement->setAttribute("ratio", $this->ratio);
    Severity: Minor
    Found in FML/Controls/Gauge.php - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    The method render() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
    Open

        public function render(\DOMDocument $domDocument)
        {
            $domElement = parent::render($domDocument);
            if ($this->ratio) {
                $domElement->setAttribute("ratio", $this->ratio);
    Severity: Minor
    Found in FML/Controls/Gauge.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

    Class constants must be uppercase; expected STYLE_PROGRESSBAR but found STYLE_ProgressBar
    Open

        const STYLE_ProgressBar      = "ProgressBar";
    Severity: Minor
    Found in FML/Controls/Gauge.php by phpcodesniffer

    The closing brace for the class must go on the next line after the body
    Open

    }
    Severity: Minor
    Found in FML/Controls/Gauge.php by phpcodesniffer

    Class constants must be uppercase; expected STYLE_BGCARD but found STYLE_BgCard
    Open

        const STYLE_BgCard           = "BgCard";
    Severity: Minor
    Found in FML/Controls/Gauge.php by phpcodesniffer

    Class constants must be uppercase; expected STYLE_ENERGYBAR but found STYLE_EnergyBar
    Open

        const STYLE_EnergyBar        = "EnergyBar";
    Severity: Minor
    Found in FML/Controls/Gauge.php by phpcodesniffer

    Class constants must be uppercase; expected STYLE_PROGRESSBARSMALL but found STYLE_ProgressBarSmall
    Open

        const STYLE_ProgressBarSmall = "ProgressBarSmall";
    Severity: Minor
    Found in FML/Controls/Gauge.php by phpcodesniffer

    The 'getDrawBackground()' method which returns a boolean should be named 'is...()' or 'has...()'
    Open

        public function getDrawBackground()
        {
            return $this->drawBackground;
        }
    Severity: Minor
    Found in FML/Controls/Gauge.php by phpmd

    BooleanGetMethodName

    Since: 0.2

    Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

    Example

    class Foo {
        /**
         * @return boolean
         */
        public function getFoo() {} // bad
        /**
         * @return bool
         */
        public function isFoo(); // ok
        /**
         * @return boolean
         */
        public function getFoo($bar); // ok, unless checkParameterizedMethods=true
    }

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

    The 'getDrawBlockBackground()' method which returns a boolean should be named 'is...()' or 'has...()'
    Open

        public function getDrawBlockBackground()
        {
            return $this->drawBlockBackground;
        }
    Severity: Minor
    Found in FML/Controls/Gauge.php by phpmd

    BooleanGetMethodName

    Since: 0.2

    Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

    Example

    class Foo {
        /**
         * @return boolean
         */
        public function getFoo() {} // bad
        /**
         * @return bool
         */
        public function isFoo(); // ok
        /**
         * @return boolean
         */
        public function getFoo($bar); // ok, unless checkParameterizedMethods=true
    }

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

    The 'getCentered()' method which returns a boolean should be named 'is...()' or 'has...()'
    Open

        public function getCentered()
        {
            return $this->centered;
        }
    Severity: Minor
    Found in FML/Controls/Gauge.php by phpmd

    BooleanGetMethodName

    Since: 0.2

    Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

    Example

    class Foo {
        /**
         * @return boolean
         */
        public function getFoo() {} // bad
        /**
         * @return bool
         */
        public function isFoo(); // ok
        /**
         * @return boolean
         */
        public function getFoo($bar); // ok, unless checkParameterizedMethods=true
    }

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

    Constant STYLE_EnergyBar should be defined in uppercase
    Open

        const STYLE_EnergyBar        = "EnergyBar";
    Severity: Minor
    Found in FML/Controls/Gauge.php by phpmd

    ConstantNamingConventions

    Since: 0.2

    Class/Interface constant names should always be defined in uppercase.

    Example

    class Foo {
        const MY_NUM = 0; // ok
        const myTest = ""; // fail
    }

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

    Constant STYLE_ProgressBarSmall should be defined in uppercase
    Open

        const STYLE_ProgressBarSmall = "ProgressBarSmall";
    Severity: Minor
    Found in FML/Controls/Gauge.php by phpmd

    ConstantNamingConventions

    Since: 0.2

    Class/Interface constant names should always be defined in uppercase.

    Example

    class Foo {
        const MY_NUM = 0; // ok
        const myTest = ""; // fail
    }

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

    Constant STYLE_BgCard should be defined in uppercase
    Open

        const STYLE_BgCard           = "BgCard";
    Severity: Minor
    Found in FML/Controls/Gauge.php by phpmd

    ConstantNamingConventions

    Since: 0.2

    Class/Interface constant names should always be defined in uppercase.

    Example

    class Foo {
        const MY_NUM = 0; // ok
        const myTest = ""; // fail
    }

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

    Constant STYLE_ProgressBar should be defined in uppercase
    Open

        const STYLE_ProgressBar      = "ProgressBar";
    Severity: Minor
    Found in FML/Controls/Gauge.php by phpmd

    ConstantNamingConventions

    Since: 0.2

    Class/Interface constant names should always be defined in uppercase.

    Example

    class Foo {
        const MY_NUM = 0; // ok
        const myTest = ""; // fail
    }

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

    There are no issues that match your filters.

    Category
    Status