Method I_can_use_it
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function I_can_use_it()
{
$equipment = new Equipment(
$belongings = $this->createBelongings($weight = $this->createWeight(123.789)),
$bodyArmorCode = BodyArmorCode::getIt(BodyArmorCode::HOBNAILED_ARMOR),
Avoid using static access to class '\DrdPlus\Codes\Armaments\BodyArmorCode' in method 'I_can_use_it'. Open
$anotherBodyArmorCode = BodyArmorCode::getIt(BodyArmorCode::WITHOUT_ARMOR);
- 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\Armaments\RangedWeaponCode' in method 'I_can_use_it'. Open
$mainHand = RangedWeaponCode::getIt(RangedWeaponCode::LIGHT_CROSSBOW),
- 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\Armaments\HelmCode' in method 'I_can_use_it'. Open
$anotherHelmCode = HelmCode::getIt(HelmCode::LEATHER_CAP);
- 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\Armaments\ShieldCode' in method 'I_can_use_it'. Open
$anotherMainHand = ShieldCode::getIt(ShieldCode::MEDIUM_SHIELD);
- 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\Armaments\BodyArmorCode' in method 'I_can_use_it'. Open
$bodyArmorCode = BodyArmorCode::getIt(BodyArmorCode::HOBNAILED_ARMOR),
- 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\Armaments\HelmCode' in method 'I_can_use_it'. Open
$helmCode = HelmCode::getIt(HelmCode::CONICAL_HELM),
- 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\Armaments\ShieldCode' in method 'I_can_use_it'. Open
$offhand = ShieldCode::getIt(ShieldCode::PAVISE)
- 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\Armaments\ShieldCode' in method 'I_can_use_it'. Open
$anotherOffhand = ShieldCode::getIt(ShieldCode::WITHOUT_SHIELD);
- 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 unused local variables such as '$weight'. Open
$belongings = $this->createBelongings($weight = $this->createWeight(123.789)),
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
The method I_can_use_it is not named in camelCase. Open
public function I_can_use_it()
{
$equipment = new Equipment(
$belongings = $this->createBelongings($weight = $this->createWeight(123.789)),
$bodyArmorCode = BodyArmorCode::getIt(BodyArmorCode::HOBNAILED_ARMOR),
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}