jaroslavtyc/drd-plus-therugist-spells

View on GitHub
DrdPlus/Theurgist/Spells/Modifier.php

Summary

Maintainability
D
1 day
Test Coverage

Showing 22 of 22 total issues

Modifier has 51 functions (exceeds 20 allowed). Consider refactoring.
Open

class Modifier extends StrictObject
{
use ToFlatArrayTrait;
 
/** @var ModifierCode */
Severity: Major
Found in DrdPlus/Theurgist/Spells/Modifier.php - About 7 hrs to fix

    File Modifier.php has 375 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    declare(strict_types=1);
     
    namespace DrdPlus\Theurgist\Spells;
     
     
    Severity: Minor
    Found in DrdPlus/Theurgist/Spells/Modifier.php - About 5 hrs to fix

      The class Modifier has an overall complexity of 74 which is very high. The configured complexity threshold is 50.
      Open

      class Modifier extends StrictObject
      {
      use ToFlatArrayTrait;
       
      /** @var ModifierCode */
      Severity: Minor
      Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

      Method sanitizeSpellParameterChanges has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      private function sanitizeSpellParameterChanges(array $spellParameterValues): array
      {
      $sanitizedChanges = [];
      foreach (ModifierMutableSpellParameterCode::getPossibleValues() as $mutableSpellParameter) {
      if (!array_key_exists($mutableSpellParameter, $spellParameterValues)) {
      Severity: Minor
      Found in DrdPlus/Theurgist/Spells/Modifier.php - About 1 hr to fix

        Method getDifficultyChange has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        public function getDifficultyChange(): DifficultyChange
        {
        $modifierParameters = [
        $this->getAttackWithAddition(),
        $this->getNumberOfConditionsWithAddition(),
        Severity: Minor
        Found in DrdPlus/Theurgist/Spells/Modifier.php - About 1 hr to fix

          The class Modifier has 49 public methods and attributes. Consider reducing the number of public items to less than 45.
          Open

          class Modifier extends StrictObject
          {
          use ToFlatArrayTrait;
           
          /** @var ModifierCode */
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Function sanitizeSpellParameterChanges has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          private function sanitizeSpellParameterChanges(array $spellParameterValues): array
          {
          $sanitizedChanges = [];
          foreach (ModifierMutableSpellParameterCode::getPossibleValues() as $mutableSpellParameter) {
          if (!array_key_exists($mutableSpellParameter, $spellParameterValues)) {
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php - About 55 mins to fix

          The class Modifier has a coupling between objects value of 33. Consider to reduce the number of dependencies under 13.
          Open

          class Modifier extends StrictObject
          {
          use ToFlatArrayTrait;
           
          /** @var ModifierCode */
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid using static access to class '\Granam\Tools\ValueDescriber' in method 'sanitizeSpellParameterChanges'.
          Open

          'Expected integer, got ' . ValueDescriber::describe($spellParameterValues[$mutableSpellParameter])
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid using static access to class '\DrdPlus\Codes\Theurgist\ModifierMutableSpellParameterCode' in method 'sanitizeSpellParameterChanges'.
          Open

          . implode(', ', ModifierMutableSpellParameterCode::getPossibleValues())
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid using static access to class '\Granam\String\StringTools' in method 'sanitizeSpellParameterChanges'.
          Open

          $getBaseParameter = StringTools::assembleGetterForName('base_' . $mutableSpellParameter);
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid using static access to class '\Granam\Integer\Tools\ToInteger' in method 'sanitizeSpellParameterChanges'.
          Open

          $sanitizedValue = ToInteger::toInteger($spellParameterValues[$mutableSpellParameter]);
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid using static access to class '\Granam\Tools\ValueDescriber' in method 'getCheckedSpellTraits'.
          Open

          'Expected instance of ' . static::class . ', got ' . ValueDescriber::describe($spellTrait)
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid using static access to class '\DrdPlus\Codes\Theurgist\ModifierMutableSpellParameterCode' in method 'sanitizeSpellParameterChanges'.
          Open

          foreach (ModifierMutableSpellParameterCode::getPossibleValues() as $mutableSpellParameter) {
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid using static access to class '\Granam\Tools\ValueDescriber' in method 'sanitizeSpellParameterChanges'.
          Open

          . ', so given spell parameter value ' . ValueDescriber::describe($spellParameterValues[$mutableSpellParameter])
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid excessively long variable names like $modifierSpellParameterChanges. Keep variable name length under 20.
          Open

          private $modifierSpellParameterChanges;
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid excessively long variable names like $modifierSpellParameterValues. Keep variable name length under 20.
          Open

          array $modifierSpellParameterValues,
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid excessively long variable names like $baseNumberOfWaypoints. Keep variable name length under 20.
          Open

          $baseNumberOfWaypoints = $this->getBaseNumberOfWaypoints();
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid excessively long variable names like $mutableSpellParameter. Keep variable name length under 20.
          Open

          foreach (ModifierMutableSpellParameterCode::getPossibleValues() as $mutableSpellParameter) {
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid excessively long variable names like $baseNumberOfSituations. Keep variable name length under 20.
          Open

          $baseNumberOfSituations = $this->getBaseNumberOfSituations();
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid excessively long variable names like $parametersDifficultyChangeSum. Keep variable name length under 20.
          Open

          $parametersDifficultyChangeSum = 0;
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd

          Avoid excessively long variable names like $spellTraitsDifficultyChangeSum. Keep variable name length under 20.
          Open

          $spellTraitsDifficultyChangeSum = 0;
          Severity: Minor
          Found in DrdPlus/Theurgist/Spells/Modifier.php by phpmd
          Category
          Status