The class AdditionByDifficultyTest has 14 public methods. Consider refactoring AdditionByDifficultyTest to keep number of public methods under 10. Open
class AdditionByDifficultyTest extends TestWithMockery
{
/**
* @test
*/
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Avoid excessively long variable names like $sameAdditionByDifficulty. Keep variable name length under 20. Open
$sameAdditionByDifficulty = new AdditionByDifficulty('1=123');
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
The method I_will_get_zero_as_difficulty_increment_of_unchangeable is not named in camelCase. Open
public function I_will_get_zero_as_difficulty_increment_of_unchangeable()
{
$additionByDifficulty = new AdditionByDifficulty('15=0');
self::assertSame(0, $additionByDifficulty->getCurrentDifficultyIncrement());
}
- 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() {
}
}
Source
The method I_can_not_create_it_with_empty_addition is not named in camelCase. Open
public function I_can_not_create_it_with_empty_addition()
{
$this->expectException(\DrdPlus\Tables\Theurgist\Spells\SpellParameters\Exceptions\InvalidFormatOfAdditionByDifficultyNotation::class);
$this->expectExceptionMessageMatches('~5=~');
new AdditionByDifficulty('5=');
- 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() {
}
}
Source
The method I_can_not_create_it_with_invalid_difficulty_price is not named in camelCase. Open
public function I_can_not_create_it_with_invalid_difficulty_price()
{
$this->expectException(\DrdPlus\Tables\Theurgist\Spells\SpellParameters\Exceptions\InvalidFormatOfDifficultyIncrement::class);
$this->expectExceptionMessageMatches('~foo~');
new AdditionByDifficulty('foo=2');
- 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() {
}
}
Source
The method I_can_not_change_it_by_sub_when_no_step is not named in camelCase. Open
public function I_can_not_change_it_by_sub_when_no_step()
{
$this->expectException(\DrdPlus\Tables\Theurgist\Spells\SpellParameters\Exceptions\AdditionByDifficultyWithoutStepsCanNotBeChanged::class);
$this->expectExceptionMessageMatches('~9~');
try {
- 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() {
}
}
Source
The method I_can_create_it_with_custom_current_addition is not named in camelCase. Open
public function I_can_create_it_with_custom_current_addition()
{
$additionByDifficulty = new AdditionByDifficulty('2=3', 7);
self::assertSame(3, $additionByDifficulty->getAdditionStep());
self::assertSame(2, $additionByDifficulty->getDifficultyPerAdditionStep());
- 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() {
}
}
Source
The method I_can_not_change_it_by_add_when_no_step is not named in camelCase. Open
public function I_can_not_change_it_by_add_when_no_step()
{
$this->expectException(\DrdPlus\Tables\Theurgist\Spells\SpellParameters\Exceptions\AdditionByDifficultyWithoutStepsCanNotBeChanged::class);
$this->expectExceptionMessageMatches('~7~');
try {
- 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() {
}
}
Source
The method I_can_create_it_with_just_an_addition is not named in camelCase. Open
public function I_can_create_it_with_just_an_addition()
{
$additionByDifficulty = new AdditionByDifficulty('123');
self::assertSame(123, $additionByDifficulty->getAdditionStep());
self::assertSame(1, $additionByDifficulty->getDifficultyPerAdditionStep());
- 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() {
}
}
Source
The method I_can_increase_current_addition is not named in camelCase. Open
public function I_can_increase_current_addition()
{
$additionByDifficulty = new AdditionByDifficulty(5);
self::assertSame(5, $additionByDifficulty->getAdditionStep());
self::assertSame(0, $additionByDifficulty->getCurrentAddition());
- 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() {
}
}
Source
The method I_can_create_it_with_explicit_difficulty_price is not named in camelCase. Open
public function I_can_create_it_with_explicit_difficulty_price()
{
$additionByDifficulty = new AdditionByDifficulty('456=789');
self::assertSame(789, $additionByDifficulty->getAdditionStep());
self::assertSame(456, $additionByDifficulty->getDifficultyPerAdditionStep());
- 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() {
}
}
Source
The method I_can_not_create_it_with_invalid_addition is not named in camelCase. Open
public function I_can_not_create_it_with_invalid_addition()
{
$this->expectException(\DrdPlus\Tables\Theurgist\Spells\SpellParameters\Exceptions\InvalidFormatOfAdditionByDifficultyValue::class);
$this->expectExceptionMessageMatches('~bar~');
new AdditionByDifficulty('13=bar');
- 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() {
}
}
Source
The method I_can_decrease_current_addition is not named in camelCase. Open
public function I_can_decrease_current_addition(): void
{
$additionByDifficulty = new AdditionByDifficulty(5);
self::assertSame(5, $additionByDifficulty->getAdditionStep());
self::assertSame(0, $additionByDifficulty->getCurrentAddition());
- 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() {
}
}
Source
The method I_can_not_create_it_with_empty_difficulty_price is not named in camelCase. Open
public function I_can_not_create_it_with_empty_difficulty_price()
{
$this->expectException(\DrdPlus\Tables\Theurgist\Spells\SpellParameters\Exceptions\InvalidFormatOfAdditionByDifficultyNotation::class);
new AdditionByDifficulty('=2');
}
- 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() {
}
}
Source
The method I_can_not_create_it_without_value is not named in camelCase. Open
public function I_can_not_create_it_without_value()
{
$this->expectException(\DrdPlus\Tables\Theurgist\Spells\SpellParameters\Exceptions\InvalidFormatOfAdditionByDifficultyNotation::class);
new AdditionByDifficulty('');
}
- 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() {
}
}
Source
The method I_can_not_create_it_with_too_many_parts is not named in camelCase. Open
public function I_can_not_create_it_with_too_many_parts()
{
$this->expectException(\DrdPlus\Tables\Theurgist\Spells\SpellParameters\Exceptions\InvalidFormatOfAdditionByDifficultyNotation::class);
$this->expectExceptionMessageMatches('~1=2=3~');
new AdditionByDifficulty('1=2=3');
- 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() {
}
}