jaroslavtyc/drd-plus-codes

View on GitHub
tests/Codes/Armaments/WeaponlikeCodeTest.php

Summary

Maintainability
A
35 mins
Test Coverage

Function Has_unique_codes_across_all_weaponlikes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function Has_unique_codes_across_all_weaponlikes()
    {
        $sutClass = self::getSutClass();
        $reflection = new \ReflectionClass($sutClass);
        $sameCodes = [];
Severity: Minor
Found in tests/Codes/Armaments/WeaponlikeCodeTest.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Missing class import via use statement (line '14', column '27').
Open

        $reflection = new \ReflectionClass(self::getSutClass());

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '31', column '27').
Open

        $reflection = new \ReflectionClass($sutClass);

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method I_can_easily_find_out_if_is_melee is not named in camelCase.
Open

    abstract public function I_can_easily_find_out_if_is_melee();

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

The method I_can_easily_find_out_if_is_shield is not named in camelCase.
Open

    abstract public function I_can_easily_find_out_if_is_shield();

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

The method I_can_easily_find_out_it_is_not_projectile is not named in camelCase.
Open

    abstract public function I_can_easily_find_out_it_is_not_projectile();

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

The method I_can_easily_find_out_if_is_weapon is not named in camelCase.
Open

    abstract public function I_can_easily_find_out_if_is_weapon();

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

The method I_can_easily_find_out_if_is_ranged is not named in camelCase.
Open

    abstract public function I_can_easily_find_out_if_is_ranged();

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

The method Has_unique_codes_across_all_weaponlikes is not named in camelCase.
Open

    public function Has_unique_codes_across_all_weaponlikes()
    {
        $sutClass = self::getSutClass();
        $reflection = new \ReflectionClass($sutClass);
        $sameCodes = [];

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

The method It_is_weaponlike_code is not named in camelCase.
Open

    public function It_is_weaponlike_code()
    {
        $reflection = new \ReflectionClass(self::getSutClass());
        /** @var WeaponlikeCode $sut */
        $sut = $reflection->newInstanceWithoutConstructor();

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

The method I_can_easily_find_out_if_weapon_is_unarmed_in_fact is not named in camelCase.
Open

    abstract public function I_can_easily_find_out_if_weapon_is_unarmed_in_fact();

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