Modifier
has 51 functions (exceeds 20 allowed). Consider refactoring.
class Modifier extends StrictObject
{
use ToFlatArrayTrait;
File Modifier.php
has 375 lines of code (exceeds 250 allowed). Consider refactoring.
<?php
declare(strict_types=1);
namespace DrdPlus\Theurgist\Spells;
The class Modifier has an overall complexity of 74 which is very high. The configured complexity threshold is 50.
class Modifier extends StrictObject
{
use ToFlatArrayTrait;
Method sanitizeSpellParameterChanges
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
private function sanitizeSpellParameterChanges(array $spellParameterValues): array
{
$sanitizedChanges = [];
foreach (ModifierMutableSpellParameterCode::getPossibleValues() as $mutableSpellParameter) {
if (!array_key_exists($mutableSpellParameter, $spellParameterValues)) {
Method getDifficultyChange
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
public function getDifficultyChange(): DifficultyChange
{
$modifierParameters = [
$this->getAttackWithAddition(),
$this->getNumberOfConditionsWithAddition(),
The class Modifier has 49 public methods and attributes. Consider reducing the number of public items to less than 45.
class Modifier extends StrictObject
{
use ToFlatArrayTrait;
Function sanitizeSpellParameterChanges
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
private function sanitizeSpellParameterChanges(array $spellParameterValues): array
{
$sanitizedChanges = [];
foreach (ModifierMutableSpellParameterCode::getPossibleValues() as $mutableSpellParameter) {
if (!array_key_exists($mutableSpellParameter, $spellParameterValues)) {
The class Modifier has a coupling between objects value of 33. Consider to reduce the number of dependencies under 13.
class Modifier extends StrictObject
{
use ToFlatArrayTrait;
Avoid using static access to class '\Granam\Tools\ValueDescriber' in method 'sanitizeSpellParameterChanges'.
'Expected integer, got ' . ValueDescriber::describe($spellParameterValues[$mutableSpellParameter])
Avoid using static access to class '\DrdPlus\Codes\Theurgist\ModifierMutableSpellParameterCode' in method 'sanitizeSpellParameterChanges'.
. implode(', ', ModifierMutableSpellParameterCode::getPossibleValues())
Avoid using static access to class '\Granam\String\StringTools' in method 'sanitizeSpellParameterChanges'.
$getBaseParameter = StringTools::assembleGetterForName('base_' . $mutableSpellParameter);
Avoid using static access to class '\Granam\Integer\Tools\ToInteger' in method 'sanitizeSpellParameterChanges'.
$sanitizedValue = ToInteger::toInteger($spellParameterValues[$mutableSpellParameter]);
Avoid using static access to class '\Granam\Tools\ValueDescriber' in method 'getCheckedSpellTraits'.
'Expected instance of ' . static::class . ', got ' . ValueDescriber::describe($spellTrait)
Avoid using static access to class '\DrdPlus\Codes\Theurgist\ModifierMutableSpellParameterCode' in method 'sanitizeSpellParameterChanges'.
foreach (ModifierMutableSpellParameterCode::getPossibleValues() as $mutableSpellParameter) {
Avoid using static access to class '\Granam\Tools\ValueDescriber' in method 'sanitizeSpellParameterChanges'.
. ', so given spell parameter value ' . ValueDescriber::describe($spellParameterValues[$mutableSpellParameter])
Avoid excessively long variable names like $modifierSpellParameterChanges. Keep variable name length under 20.
private $modifierSpellParameterChanges;
Avoid excessively long variable names like $modifierSpellParameterValues. Keep variable name length under 20.
array $modifierSpellParameterValues,
Avoid excessively long variable names like $baseNumberOfWaypoints. Keep variable name length under 20.
$baseNumberOfWaypoints = $this->getBaseNumberOfWaypoints();
Avoid excessively long variable names like $mutableSpellParameter. Keep variable name length under 20.
foreach (ModifierMutableSpellParameterCode::getPossibleValues() as $mutableSpellParameter) {
Avoid excessively long variable names like $baseNumberOfSituations. Keep variable name length under 20.
$baseNumberOfSituations = $this->getBaseNumberOfSituations();
Avoid excessively long variable names like $parametersDifficultyChangeSum. Keep variable name length under 20.
$parametersDifficultyChangeSum = 0;
Avoid excessively long variable names like $spellTraitsDifficultyChangeSum. Keep variable name length under 20.
$spellTraitsDifficultyChangeSum = 0;
There are no issues that match your filters.