jaroslavtyc/drd-plus-equipment

View on GitHub
tests/Equipment/EquipmentTest.php

Summary

Maintainability
A
1 hr
Test Coverage

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),
Severity: Minor
Found in tests/Equipment/EquipmentTest.php - About 1 hr to fix

    Avoid using static access to class '\DrdPlus\Codes\Armaments\BodyArmorCode' in method 'I_can_use_it'.
    Open

            $anotherBodyArmorCode = BodyArmorCode::getIt(BodyArmorCode::WITHOUT_ARMOR);
    Severity: Minor
    Found in tests/Equipment/EquipmentTest.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\Armaments\RangedWeaponCode' in method 'I_can_use_it'.
    Open

                $mainHand = RangedWeaponCode::getIt(RangedWeaponCode::LIGHT_CROSSBOW),
    Severity: Minor
    Found in tests/Equipment/EquipmentTest.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\Armaments\HelmCode' in method 'I_can_use_it'.
    Open

            $anotherHelmCode = HelmCode::getIt(HelmCode::LEATHER_CAP);
    Severity: Minor
    Found in tests/Equipment/EquipmentTest.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\Armaments\ShieldCode' in method 'I_can_use_it'.
    Open

            $anotherMainHand = ShieldCode::getIt(ShieldCode::MEDIUM_SHIELD);
    Severity: Minor
    Found in tests/Equipment/EquipmentTest.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\Armaments\BodyArmorCode' in method 'I_can_use_it'.
    Open

                $bodyArmorCode = BodyArmorCode::getIt(BodyArmorCode::HOBNAILED_ARMOR),
    Severity: Minor
    Found in tests/Equipment/EquipmentTest.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\Armaments\HelmCode' in method 'I_can_use_it'.
    Open

                $helmCode = HelmCode::getIt(HelmCode::CONICAL_HELM),
    Severity: Minor
    Found in tests/Equipment/EquipmentTest.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\Armaments\ShieldCode' in method 'I_can_use_it'.
    Open

                $offhand = ShieldCode::getIt(ShieldCode::PAVISE)
    Severity: Minor
    Found in tests/Equipment/EquipmentTest.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\Armaments\ShieldCode' in method 'I_can_use_it'.
    Open

            $anotherOffhand = ShieldCode::getIt(ShieldCode::WITHOUT_SHIELD);
    Severity: Minor
    Found in tests/Equipment/EquipmentTest.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 unused local variables such as '$weight'.
    Open

                $belongings = $this->createBelongings($weight = $this->createWeight(123.789)),
    Severity: Minor
    Found in tests/Equipment/EquipmentTest.php by phpmd

    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),
    Severity: Minor
    Found in tests/Equipment/EquipmentTest.php by phpmd

    CamelCaseMethodName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name methods.

    Example

    class ClassName {
        public function get_name() {
        }
    }

    Source

    There are no issues that match your filters.

    Category
    Status