jaroslavtyc/drd-plus-health

View on GitHub

Showing 669 of 669 total issues

Missing class import via use statement (line '40', column '17').
Open

            new \DateInterval('P1D'),

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 createWound has a boolean flag argument $isOld, which is a certain sign of a Single Responsibility Principle violation.
Open

    protected function createWound($isSerious = true, $isOld = false, $value = 0, WoundOriginCode $woundOriginCode = null)

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

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

        $healthProperty = new \ReflectionProperty(Affliction::class, 'health');

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 '1112', column '33').
Open

        $healthReflection = new \ReflectionClass($health);
Severity: Minor
Found in tests/Health/HealthTest.php by phpmd

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 createGlare has a boolean flag argument $isShined, which is a certain sign of a Single Responsibility Principle violation.
Open

    private function createGlare($malus = -123, $isShined = true)
Severity: Minor
Found in tests/Health/HealthTest.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The method createHealth has a boolean flag argument $openForNewWounds, which is a certain sign of a Single Responsibility Principle violation.
Open

    private function createHealth($openForNewWounds = true)
Severity: Minor
Found in tests/Health/WoundTest.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Avoid using static access to class 'DrdPlus\Health\ReasonToRollAgainstMalusFromWounds' in method 'resolveMalusAfterWound'.
Open

            $this->reasonToRollAgainstMalusFromWounds = ReasonToRollAgainstMalusFromWounds::getWoundReason();
Severity: Minor
Found in Health/Health.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\Calculations\SumAndRound' in method 'getKnackMalus'.
Open

        return -SumAndRound::ceil($cold->getAfflictionSize()->getValue() / 4);

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\Calculations\SumAndRound' in method 'getNumberOfFilledRows'.
Open

        $numberOfFilledRows = SumAndRound::floor($this->health->getUnhealedWoundsSum() / $this->getWoundsPerRowMaximum($woundBoundary));
Severity: Minor
Found in Health/GridOfWounds.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\Health\Inflictions\Glared' in method 'inflictByGlare'.
Open

        $this->glared = Glared::createFromGlare($glare, $this);
Severity: Minor
Found in Health/Health.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 'convertToEnumFinalValue'.
Open

            throw new Exceptions\UnknownAfflictionDomain('unexpected affliction domain ' . ValueDescriber::describe($enumValue));

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\Calculations\SumAndRound' in method 'getAgilityMalus'.
Open

        return -SumAndRound::ceil($cold->getAfflictionSize()->getValue() / 4);

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\Health\Afflictions\AfflictionProperty' in method 'createIt'.
Open

            AfflictionProperty::getIt(PropertyCode::TOUGHNESS),

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\Health\Afflictions\ElementalPertinence\WaterPertinence' in method 'createIt'.
Open

            WaterPertinence::getMinus(),

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\Health\Afflictions\AfflictionSize' in method 'createIt'.
Open

            AfflictionSize::getIt(4),

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\Health\Afflictions\AfflictionProperty' in method 'createIt'.
Open

            AfflictionProperty::getIt(PropertyCode::TOUGHNESS),

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\Health\Afflictions\AfflictionDangerousness' in method 'createIt'.
Open

            AfflictionDangerousness::getIt(15),

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\Health\Afflictions\AfflictionDomain' in method 'createIt'.
Open

            AfflictionDomain::getPhysicalDomain(),

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\Health\Afflictions\AfflictionSource' in method 'createIt'.
Open

            AfflictionSource::getExternalSource(),

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

The method calculateFilledHalfRowsFor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            // first half round up, second down (for example 11 = 6 + 5)
            $halves = [SumAndRound::ceiledHalf($this->getWoundsPerRowMaximum($woundBoundary)), SumAndRound::flooredHalf($this->getWoundsPerRowMaximum($woundBoundary))];
            $filledHalfRows = 0;
            $woundSizeValue = $woundSize->getValue();
Severity: Minor
Found in Health/GridOfWounds.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Severity
Category
Status
Source
Language