Showing 16 of 16 total issues
Avoid using static access to class '\Granam\Scalar\Tools\ToString' in method '__construct'. Open
$parts = $this->parseParts(ToString::toString($additionByDifficultyNotation));
- Read upRead up
- Exclude checks
Avoid using static access to class '\Granam\Integer\Tools\ToInteger' in method 'sub'. Open
$this->getValue() - ToInteger::toInteger($value) // current addition is injected as second parameter
- Read upRead up
- Exclude checks
The method __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else { throw new Exceptions\InvalidFormatOfAdditionByDifficultyNotation( "Expected addition by difficulty in format 'number' or 'number=number', got " . ValueDescriber::describe($additionByDifficultyNotation) );
- Read upRead up
- Exclude checks
Avoid using static access to class '\Granam\Integer\Tools\ToInteger' in method 'sanitizeAddition'. Open
return ToInteger::toInteger($addition);
- Read upRead up
- Exclude checks
Avoid using static access to class '\Granam\Tools\ValueDescriber' in method 'sub'. Open
'With zero step can not be an addition changed by ' . ValueDescriber::describe($value)
- Read upRead up
- Exclude checks
Avoid using static access to class '\Granam\Integer\Tools\ToInteger' in method 'sanitizeDifficulty'. Open
return ToInteger::toPositiveInteger($difficultyChange);
- Read upRead up
- Exclude checks
Avoid using static access to class '\Granam\Tools\ValueDescriber' in method 'sanitizeAddition'. Open
'Expected integer for addition by difficulty, got ' . ValueDescriber::describe($addition)
- Read upRead up
- Exclude checks
Avoid using static access to class '\Granam\Integer\Tools\ToInteger' in method 'add'. Open
$this->getValue() + ToInteger::toInteger($value) // current addition is injected as second parameter
- Read upRead up
- Exclude checks
Avoid using static access to class '\Granam\Integer\Tools\ToInteger' in method 'getCurrentDifficultyIncrement'. Open
return ToInteger::toInteger(\ceil($this->getCurrentAddition() / $this->getAdditionStep() * $this->getDifficultyPerAdditionStep()));
- Read upRead up
- Exclude checks
Avoid using static access to class '\Granam\Tools\ValueDescriber' in method 'add'. Open
'With zero step can not be an addition changed by ' . ValueDescriber::describe($value)
- Read upRead up
- Exclude checks
Avoid using static access to class '\Granam\Tools\ValueDescriber' in method '__construct'. Open
. ValueDescriber::describe($additionByDifficultyNotation)
- Read upRead up
- Exclude checks
Avoid using static access to class '\Granam\Tools\ValueDescriber' in method 'sanitizeDifficulty'. Open
'Expected positive integer for difficulty increment , got ' . ValueDescriber::describe($difficultyChange)
- Read upRead up
- Exclude checks
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function __construct($additionByDifficultyNotation, int $currentAddition = null) { $parts = $this->parseParts(ToString::toString($additionByDifficultyNotation)); if (\count($parts) === 1 && \array_keys($parts) === [0]) { $this->difficultyPerAdditionStep = 1;
- Read upRead up
Avoid excessively long variable names like $additionByDifficultyNotation. Keep variable name length under 20. Open
public function __construct($additionByDifficultyNotation, int $currentAddition = null)
- Read upRead up
- Exclude checks
Avoid excessively long variable names like $difficultyPerAdditionStep. Keep variable name length under 20. Open
private $difficultyPerAdditionStep;
- Read upRead up
- Exclude checks
Avoid excessively long variable names like $additionByDifficultyNotation. Keep variable name length under 20. Open
private function parseParts(string $additionByDifficultyNotation): array
- Read upRead up
- Exclude checks