steeffeen/FancyManiaLinks

View on GitHub
FML/Script/Features/GraphCurve.php

Summary

Maintainability
A
1 hr
Test Coverage
D
66%

Method getScriptText has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getScriptText()
    {
        $graphId    = Builder::escapeText($this->graph->getId(), false);
        $scriptText = "
declare Graph <=> (Page.GetFirstChild(\"{$graphId}\") as CMlGraph);
Severity: Minor
Found in FML/Script/Features/GraphCurve.php - About 1 hr to fix

    Avoid using static access to class '\FML\Script\Builder' in method 'getScriptText'.
    Open

                $pointVec2  = Builder::getVec2($point);
    Severity: Minor
    Found in FML/Script/Features/GraphCurve.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 '\FML\Script\Builder' in method 'getScriptText'.
    Open

                $colorVec3  = Builder::getVec3($this->color);
    Severity: Minor
    Found in FML/Script/Features/GraphCurve.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 '\FML\Script\Builder' in method 'getScriptText'.
    Open

            $graphId    = Builder::escapeText($this->graph->getId(), false);
    Severity: Minor
    Found in FML/Script/Features/GraphCurve.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 closing brace for the class must go on the next line after the body
    Open

    }

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

        public function getSortPoints()
        {
            return $this->sortPoints;
        }
    Severity: Minor
    Found in FML/Script/Features/GraphCurve.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

    There are no issues that match your filters.

    Category
    Status