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)
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)
- Exclude checks
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;
Method getWeightInKg
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
RaceCode $raceCode,
SubRaceCode $subRaceCode,
GenderCode $genderCode,
FemaleModifiersTable $femaleModifiersTable,
WeightTable $weightTable
Avoid using static access to class '\DrdPlus\Codes\GenderCode' in method 'getFemaleWill'. Open
return $this->getWill($raceCode, $subRaceCode, GenderCode::getIt(GenderCode::FEMALE));
- Read upRead up
- Exclude checks
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));
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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++ ) {
}
}
}