jaroslavtyc/drd-plus-tables

View on GitHub
src/Theurgist/Spells/ModifiersTable.php

Summary

Maintainability
C
7 hrs
Test Coverage

ModifiersTable has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

class ModifiersTable extends AbstractFileTable
{
    use ToFlatArrayTrait;

    private \DrdPlus\Tables\Tables $tables;
Severity: Minor
Found in src/Theurgist/Spells/ModifiersTable.php - About 3 hrs to fix

    File ModifiersTable.php has 303 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php declare(strict_types=1);
    
    namespace DrdPlus\Tables\Theurgist\Spells;
    
    use DrdPlus\Codes\Theurgist\ModifierMutableParameterCode;
    Severity: Minor
    Found in src/Theurgist/Spells/ModifiersTable.php - About 3 hrs to fix

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

          protected function getExpectedDataHeaderNamesToTypes(): array
          {
              return [
                  self::REALM => self::POSITIVE_INTEGER,
                  self::REALMS_AFFECTION => self::ARRAY,
      Severity: Minor
      Found in src/Theurgist/Spells/ModifiersTable.php - About 1 hr to fix

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

        class ModifiersTable extends AbstractFileTable
        {
            use ToFlatArrayTrait;
        
            private \DrdPlus\Tables\Tables $tables;

        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\Codes\Theurgist\SpellTraitCode' in method 'getSpellTraitCodes'.
        Open

                    fn(string $spellTraitValue) => SpellTraitCode::getIt($spellTraitValue),

        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\Codes\Theurgist\ProfileCode' in method 'getProfileCodes'.
        Open

                        fn(string $profileValue) => ProfileCode::getIt($profileValue),

        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\Codes\Theurgist\FormulaCode' in method 'getFormulaCodes'.
        Open

                        fn(string $formulaValue) => FormulaCode::getIt($formulaValue),

        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\Codes\Theurgist\ModifierCode' in method 'getChildModifierCodes'.
        Open

                        fn(string $modifierValue) => ModifierCode::getIt($modifierValue),

        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\Codes\Theurgist\FormCode' in method 'getFormCodes'.
        Open

                    fn(string $formValue) => FormCode::getIt($formValue),

        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\Codes\Theurgist\ModifierCode' in method 'getParentModifierCodes'.
        Open

                        fn(string $modifierValue) => ModifierCode::getIt($modifierValue),

        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 $numberOfWaypointsValues. Keep variable name length under 20.
        Open

                $numberOfWaypointsValues = $this->getValue($modifierCode, self::NUMBER_OF_WAYPOINTS);

        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 $numberOfSituationsValue. Keep variable name length under 20.
        Open

                $numberOfSituationsValue = $this->getValue($modifierCode, self::NUMBER_OF_SITUATIONS);

        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