jaroslavtyc/drd-plus-stamina

View on GitHub
Stamina/Stamina.php

Summary

Maintainability
A
2 hrs
Test Coverage

Stamina has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Stamina extends StrictObject
{
    /**
     * @var Fatigue
     */
Severity: Minor
Found in Stamina/Stamina.php - About 2 hrs to fix

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

    class Stamina extends StrictObject
    {
        /**
         * @var Fatigue
         */
    Severity: Minor
    Found in Stamina/Stamina.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

    Avoid using static access to class 'DrdPlus\Stamina\Fatigue' in method '__construct'.
    Open

            $this->fatigue = Fatigue::getIt(0);
    Severity: Minor
    Found in Stamina/Stamina.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 'DrdPlus\Stamina\ReasonToRollAgainstMalusFromFatigue' in method 'resolveMalusAfterRest'.
    Open

                $this->reasonToRollAgainstMalusFromFatigue = ReasonToRollAgainstMalusFromFatigue::getRestReason();
    Severity: Minor
    Found in Stamina/Stamina.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 'DrdPlus\Stamina\MalusFromFatigue' in method '__construct'.
    Open

            $this->malusFromFatigue = MalusFromFatigue::getIt(0);
    Severity: Minor
    Found in Stamina/Stamina.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 'DrdPlus\Stamina\MalusFromFatigue' in method 'setMalusFromFatigue'.
    Open

            return $this->malusFromFatigue = MalusFromFatigue::getIt($rollOnWillAgainstMalus->getMalusValue());
    Severity: Minor
    Found in Stamina/Stamina.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 'DrdPlus\Stamina\MalusFromFatigue' in method 'getMalusFromFatigue'.
    Open

                return MalusFromFatigue::getIt(0);
    Severity: Minor
    Found in Stamina/Stamina.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 'DrdPlus\Stamina\MalusFromFatigue' in method 'resolveMalusAfterRest'.
    Open

                $this->malusFromFatigue = MalusFromFatigue::getIt(0); // pain is gone and being feel it - lets remove the malus
    Severity: Minor
    Found in Stamina/Stamina.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 'DrdPlus\Stamina\ReasonToRollAgainstMalusFromFatigue' in method 'resolveMalusAfterFatigue'.
    Open

                $this->reasonToRollAgainstMalusFromFatigue = ReasonToRollAgainstMalusFromFatigue::getFatigueReason();
    Severity: Minor
    Found in Stamina/Stamina.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 'DrdPlus\Stamina\MalusFromFatigue' in method 'resolveMalusAfterFatigue'.
    Open

                $this->malusFromFatigue = MalusFromFatigue::getIt(0);
    Severity: Minor
    Found in Stamina/Stamina.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 'DrdPlus\Stamina\Fatigue' in method 'rest'.
    Open

            $this->fatigue = Fatigue::getIt($remainingFatigue);
    Severity: Minor
    Found in Stamina/Stamina.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 'DrdPlus\Stamina\Fatigue' in method 'addFatigue'.
    Open

            $this->fatigue = Fatigue::getIt($this->fatigue->getValue() + $fatigue->getValue());
    Severity: Minor
    Found in Stamina/Stamina.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 excessively long variable names like $rollOnWillAgainstMalus. Keep variable name length under 20.
    Open

        private function setMalusFromFatigue(RollOnWillAgainstMalus $rollOnWillAgainstMalus): MalusFromFatigue
    Severity: Minor
    Found in Stamina/Stamina.php by phpmd

    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

    Avoid excessively long variable names like $reasonToRollAgainstMalusFromFatigue. Keep variable name length under 20.
    Open

        private $reasonToRollAgainstMalusFromFatigue;
    Severity: Minor
    Found in Stamina/Stamina.php by phpmd

    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