jaroslavtyc/drd-plus-profession-levels

View on GitHub
src/ProfessionLevels/ProfessionNextLevel.php

Summary

Maintainability
A
1 hr
Test Coverage

Method createNextLevel has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

        Profession $profession,
        LevelRank $nextLevelRank,
        Strength $strengthIncrement,
        Agility $agilityIncrement,
        Knack $knackIncrement,
Severity: Major
Found in src/ProfessionLevels/ProfessionNextLevel.php - About 1 hr to fix

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

    class ProfessionNextLevel extends ProfessionLevel
    {
        private ?\DrdPlus\Person\ProfessionLevels\ProfessionLevels $professionLevels = null;
    
        /**

    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

    Avoid unused parameters such as '$profession'.
    Open

        protected function checkPropertyIncrement(BaseProperty $baseProperty, Profession $profession)

    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 excessively long variable names like $intelligenceIncrement. Keep variable name length under 20.
    Open

            Intelligence $intelligenceIncrement,

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

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

    There are no issues that match your filters.

    Category
    Status