steeffeen/FancyManiaLinks

View on GitHub
FML/ManiaCode.php

Summary

Maintainability
A
2 hrs
Test Coverage
A
100%

The class ManiaCode has 22 public methods. Consider refactoring ManiaCode to keep number of public methods under 10.
Open

class ManiaCode
{

    /**
     * @var bool $disableConfirmation Disable the confirmation
Severity: Minor
Found in FML/ManiaCode.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

ManiaCode has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class ManiaCode
{

    /**
     * @var bool $disableConfirmation Disable the confirmation
Severity: Minor
Found in FML/ManiaCode.php - About 2 hrs to fix

    The class ManiaCode has a coupling between objects value of 18. Consider to reduce the number of dependencies under 13.
    Open

    class ManiaCode
    {
    
        /**
         * @var bool $disableConfirmation Disable the confirmation
    Severity: Minor
    Found in FML/ManiaCode.php by phpmd

    CouplingBetweenObjects

    Since: 1.1.0

    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

    Example

    class Foo {
        /**
         * @var \foo\bar\X
         */
        private $x = null;
    
        /**
         * @var \foo\bar\Y
         */
        private $y = null;
    
        /**
         * @var \foo\bar\Z
         */
        private $z = null;
    
        public function setFoo(\Foo $foo) {}
        public function setBar(\Bar $bar) {}
        public function setBaz(\Baz $baz) {}
    
        /**
         * @return \SplObjectStorage
         * @throws \OutOfRangeException
         * @throws \InvalidArgumentException
         * @throws \ErrorException
         */
        public function process(\Iterator $it) {}
    
        // ...
    }

    Source https://phpmd.org/rules/design.html#couplingbetweenobjects

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

        public function render($echo = false)
    Severity: Minor
    Found in FML/ManiaCode.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

    Missing class import via use statement (line '364', column '43').
    Open

            $domDocument                = new \DOMDocument("1.0", "utf-8");
    Severity: Minor
    Found in FML/ManiaCode.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

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

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

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

        public function getDisableConfirmation()
        {
            return $this->disableConfirmation;
        }
    Severity: Minor
    Found in FML/ManiaCode.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