jaroslavtyc/drd-plus-rolls-on

View on GitHub
tests/RollsOn/RollsOnFactoryTest.php

Summary

Maintainability
A
0 mins
Test Coverage

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

    private function createRoller2d6DrdPlus($rollValue = false)
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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 createRoll has a boolean flag argument $rollValue, which is a certain sign of a Single Responsibility Principle violation.
Open

    private function createRoll($rollValue = false)
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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\BaseProperties\Will' in method 'I_can_make_malus_roll_on_will'.
Open

        $malusRollOnWill = $rollsOnFactory->makeMalusRollOnWill(Will::getIt($willValue));
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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 '$roller'.
Open

            $roller = $this->createRoller($roll = $this->createRoll($rollValue = 456))
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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

Avoid unused local variables such as '$rollOnQuality'.
Open

        self::assertInstanceOf(RollOnQuality::class, $rollOnQuality = $malusRollOnWill->getRollOnQuality());
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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

Avoid unused local variables such as '$roller'.
Open

        $rollsOn = new RollsOnFactory($roller = $this->createRoller2d6DrdPlus($rollValue = 123));
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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

Avoid unused local variables such as '$preconditionsSum'.
Open

            $preconditionsSum = 456,
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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_make_basic_roll_on_success is not named in camelCase.
Open

    public function I_can_make_basic_roll_on_success()
    {
        $rollsOn = new RollsOnFactory($this->createRoller2d6DrdPlus());

        $basicRollOnSuccess = $rollsOn->makeBasicRollOnSuccess(
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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

The method I_can_make_malus_roll_on_will is not named in camelCase.
Open

    public function I_can_make_malus_roll_on_will($rollValue, $willValue, $expectedMalus)
    {
        $rollsOnFactory = new RollsOnFactory($this->createRoller2d6DrdPlus($rollValue));

        $malusRollOnWill = $rollsOnFactory->makeMalusRollOnWill(Will::getIt($willValue));
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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

The method I_can_make_roll_on_quality is not named in camelCase.
Open

    public function I_can_make_roll_on_quality()
    {
        $rollsOn = new RollsOnFactory($this->createRoller2d6DrdPlus());

        $rollOnQuality = $rollsOn->makeRollOnQuality(
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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

The method I_can_make_roll_on_fight is not named in camelCase.
Open

    public function I_can_make_roll_on_fight(): void
    {
        $rollsOn = new RollsOnFactory($roller = $this->createRoller2d6DrdPlus($rollValue = 123));
        $rollOnFight = $rollsOn->makeRollOnFight($fightNumber = 55667788);
        self::assertSame($fightNumber, $rollOnFight->getFightNumber());
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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