jaroslavtyc/drd-plus-tables

View on GitHub
src/Races/RacesTable.php

Summary

Maintainability
C
1 day
Test Coverage

RacesTable has 46 functions (exceeds 20 allowed). Consider refactoring.
Open

class RacesTable extends AbstractFileTable
{
    private \DrdPlus\Tables\Races\FemaleModifiersTable $femaleModifiersTable;

    public function __construct(FemaleModifiersTable $femaleModifiersTable)
Severity: Minor
Found in src/Races/RacesTable.php - About 6 hrs to fix

    The class RacesTable has an overall complexity of 52 which is very high. The configured complexity threshold is 50.
    Open

    class RacesTable extends AbstractFileTable
    {
        private \DrdPlus\Tables\Races\FemaleModifiersTable $femaleModifiersTable;
    
        public function __construct(FemaleModifiersTable $femaleModifiersTable)
    Severity: Minor
    Found in src/Races/RacesTable.php by phpmd

    File RacesTable.php has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php declare(strict_types = 1);
    
    namespace DrdPlus\Tables\Races;
    
    use DrdPlus\Codes\GenderCode;
    Severity: Minor
    Found in src/Races/RacesTable.php - About 2 hrs to fix

      Method getWeightInKg has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              RaceCode $raceCode,
              SubRaceCode $subRaceCode,
              GenderCode $genderCode,
              FemaleModifiersTable $femaleModifiersTable,
              WeightTable $weightTable
      Severity: Minor
      Found in src/Races/RacesTable.php - About 35 mins to fix

        Avoid using static access to class '\DrdPlus\Codes\GenderCode' in method 'getFemaleWill'.
        Open

                return $this->getWill($raceCode, $subRaceCode, GenderCode::getIt(GenderCode::FEMALE));
        Severity: Minor
        Found in src/Races/RacesTable.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\Codes\GenderCode' in method 'getMaleWill'.
        Open

                return $this->getWill($raceCode, $subRaceCode, GenderCode::getIt(GenderCode::MALE));
        Severity: Minor
        Found in src/Races/RacesTable.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 '\Granam\Tools\ValueDescriber' in method 'getWeightInKg'.
        Open

                            'Unknown gender ' . ValueDescriber::describe($genderCode)
        Severity: Minor
        Found in src/Races/RacesTable.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 '\Granam\Tools\ValueDescriber' in method 'getSize'.
        Open

                            . ', got ' . ValueDescriber::describe($genderCode)
        Severity: Minor
        Found in src/Races/RacesTable.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 $femaleWeightBonusValue. Keep variable name length under 20.
        Open

                $femaleWeightBonusValue = $maleWeightBonus->getValue() + $femaleWeightBonusModifier;
        Severity: Minor
        Found in src/Races/RacesTable.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 $femaleWeightBonusModifier. Keep variable name length under 20.
        Open

                $femaleWeightBonusModifier = $femaleModifiersTable->getWeightBonus($raceCode);
        Severity: Minor
        Found in src/Races/RacesTable.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