jaroslavtyc/drd-plus-tables

View on GitHub
tests/Tables/Theurgist/Spells/ModifierTest.php

Summary

Maintainability
D
2 days
Test Coverage

File ModifierTest.php has 365 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types = 1);

namespace DrdPlus\Tests\Tables\Theurgist\Spells;

use DrdPlus\Tables\Tables;
Severity: Minor
Found in tests/Tables/Theurgist/Spells/ModifierTest.php - About 4 hrs to fix

    The class ModifierTest has 12 public methods. Consider refactoring ModifierTest to keep number of public methods under 10.
    Open

    class ModifierTest extends TestWithMockery
    {
        private string $parameterNamespace;
    
        protected function setUp(): void

    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

    ModifierTest has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ModifierTest extends TestWithMockery
    {
        private string $parameterNamespace;
    
        protected function setUp(): void
    Severity: Minor
    Found in tests/Tables/Theurgist/Spells/ModifierTest.php - About 2 hrs to fix

      Method I_can_create_it_with_change_for_every_modifier has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function I_can_create_it_with_change_for_every_modifier()
          {
              $parameterChanges = [];
              foreach (ModifierMutableParameterCode::getPossibleValues() as $index => $parameterName) {
                  $parameterChanges[$parameterName] = $index + 1; // 1...x
      Severity: Minor
      Found in tests/Tables/Theurgist/Spells/ModifierTest.php - About 1 hr to fix

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

            public function I_can_not_create_it_with_non_integer_addition()
            {
                $this->expectException(\DrdPlus\Tables\Theurgist\Spells\Exceptions\InvalidValueForModifierParameter::class);
                $this->expectExceptionMessageMatches('~0\.1~');
                $modifiersTable = $this->createModifiersTable();
        Severity: Minor
        Found in tests/Tables/Theurgist/Spells/ModifierTest.php - About 1 hr to fix

          Method I_can_not_add_non_zero_addition_to_unused_parameter has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function I_can_not_add_non_zero_addition_to_unused_parameter()
              {
                  $this->expectException(\DrdPlus\Tables\Theurgist\Spells\Exceptions\UnknownModifierParameter::class);
                  $this->expectExceptionMessageMatches('~4~');
                  $modifiersTable = $this->createModifiersTable();
          Severity: Minor
          Found in tests/Tables/Theurgist/Spells/ModifierTest.php - About 1 hr to fix

            Method I_get_basic_difficulty_change_with_every_parameter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function I_get_basic_difficulty_change_with_every_parameter()
                {
                    foreach (ModifierCode::getPossibleValues() as $modifierValue) {
                        $modifierCode = ModifierCode::getIt($modifierValue);
                        $modifiersTable = $this->createModifiersTable();
            Severity: Minor
            Found in tests/Tables/Theurgist/Spells/ModifierTest.php - About 1 hr to fix

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

                  public function I_can_create_it_with_change_for_every_modifier()
                  {
                      $parameterChanges = [];
                      foreach (ModifierMutableParameterCode::getPossibleValues() as $index => $parameterName) {
                          $parameterChanges[$parameterName] = $index + 1; // 1...x
              Severity: Minor
              Found in tests/Tables/Theurgist/Spells/ModifierTest.php - About 55 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

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

              class ModifierTest extends TestWithMockery
              {
                  private string $parameterNamespace;
              
                  protected function setUp(): void

              CouplingBetweenObjects

              Since: 1.1.0

              A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

              Example

              class Foo {
                  /**
                   * @var \foo\bar\X
                   */
                  private $x = null;
              
                  /**
                   * @var \foo\bar\Y
                   */
                  private $y = null;
              
                  /**
                   * @var \foo\bar\Z
                   */
                  private $z = null;
              
                  public function setFoo(\Foo $foo) {}
                  public function setBar(\Bar $bar) {}
                  public function setBaz(\Baz $baz) {}
              
                  /**
                   * @return \SplObjectStorage
                   * @throws \OutOfRangeException
                   * @throws \InvalidArgumentException
                   * @throws \ErrorException
                   */
                  public function process(\Iterator $it) {}
              
                  // ...
              }

              Source https://phpmd.org/rules/design.html#couplingbetweenobjects

              Missing class import via use statement (line '28', column '42').
              Open

                      $this->parameterNamespace = (new \ReflectionClass(SpellSpeed::class))->getNamespaceName();

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '480', column '98').
              Open

                      new Modifier(ModifierCode::getIt(ModifierCode::TRANSPOSITION), Tables::getIt(), [], [new \DateTime()]);

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Avoid using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_create_it_without_any_change_for_every_modifier'.
              Open

                      foreach (ModifierCode::getPossibleValues() as $modifierValue) {

              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 using static access to class '\Granam\String\StringTools' in method 'I_get_null_for_unused_modifiers_for_every_modifier'.
              Open

                              $getBaseParameter = StringTools::assembleGetterForName('base_' . $mutableParameterName);

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_create_it_with_change_for_every_modifier'.
              Open

                      foreach (ModifierCode::getPossibleValues() as $modifierValue) {

              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 using static access to class '\Granam\String\StringTools' in method 'I_can_create_it_with_change_for_every_modifier'.
              Open

                              $getParameterWithAddition = StringTools::assembleGetterForName($parameterName . '_with_addition');

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_get_basic_difficulty_change_with_every_parameter'.
              Open

                          $modifierCode = ModifierCode::getIt($modifierValue);

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_not_add_non_zero_addition_to_unused_parameter'.
              Open

                          $modifierCode = ModifierCode::getIt(ModifierCode::COLOR),

              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 using static access to class '\DrdPlus\Tables\Tables' in method 'I_can_not_create_it_with_addition_of_unknown_parameter'.
              Open

                      new Modifier(ModifierCode::getIt(ModifierCode::TRANSPOSITION), Tables::getIt(), ['useless' => 0], []);

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_create_it_without_any_change_for_every_modifier'.
              Open

                          $modifierCode = ModifierCode::getIt($modifierValue);

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_get_null_for_unused_modifiers_for_every_modifier'.
              Open

                          $modifierCode = ModifierCode::getIt($modifierValue);

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierMutableParameterCode' in method 'I_get_basic_difficulty_change_without_any_parameter'.
              Open

                          foreach (ModifierMutableParameterCode::getPossibleValues() as $mutableParameterName) {

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_create_it_with_non_spell_trait_as_spell_trait'.
              Open

                      new Modifier(ModifierCode::getIt(ModifierCode::TRANSPOSITION), Tables::getIt(), [], [new \DateTime()]);

              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 using static access to class '\Granam\String\StringTools' in method 'I_get_null_for_unused_modifiers_for_every_modifier'.
              Open

                              $getCurrentParameter = StringTools::assembleGetterForName($mutableParameterName . '_with_addition');

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_not_create_it_with_addition_of_unknown_parameter'.
              Open

                      new Modifier(ModifierCode::getIt(ModifierCode::TRANSPOSITION), Tables::getIt(), ['useless' => 0], []);

              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 using static access to class '\Granam\String\StringTools' in method 'I_can_create_it_without_any_change_for_every_modifier'.
              Open

                              $getBaseParameter = StringTools::assembleGetterForName('base_' . $mutableParameterName);

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierMutableParameterCode' in method 'I_can_create_it_with_change_for_every_modifier'.
              Open

                          foreach (ModifierMutableParameterCode::getPossibleValues() as $parameterName) {

              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 using static access to class '\Granam\String\StringTools' in method 'I_can_create_it_with_change_for_every_modifier'.
              Open

                              $getParameterAddition = StringTools::assembleGetterForName($parameterName) . 'Addition';

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_get_realms_affection'.
              Open

                              $modifierCode = ModifierCode::getIt($modifierValue),

              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 using static access to class '\Granam\String\StringTools' in method 'getParameterClass'.
              Open

                      $parameterClassBasename = ucfirst(StringTools::assembleMethodName($parameterName));

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierMutableParameterCode' in method 'I_can_create_it_with_change_for_every_modifier'.
              Open

                          foreach (ModifierMutableParameterCode::getPossibleValues() as $parameterName) {

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_get_required_realm_for_modifier'.
              Open

                          $modifierCode = ModifierCode::getIt(ModifierCode::TRANSPOSITION),

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_get_null_for_unused_modifiers_for_every_modifier'.
              Open

                      foreach (ModifierCode::getPossibleValues() as $modifierValue) {

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_get_basic_difficulty_change_without_any_parameter'.
              Open

                          $modifierCode = ModifierCode::getIt($modifierValue);

              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 using static access to class '\DrdPlus\Tables\Tables' in method 'I_can_get_realms_affection'.
              Open

                              Tables::getIt(),

              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 using static access to class '\Granam\String\StringTools' in method 'I_can_create_it_without_any_change_for_every_modifier'.
              Open

                              $getCurrentParameter = StringTools::assembleGetterForName($mutableParameterName . '_with_addition');

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_not_create_it_with_non_integer_addition'.
              Open

                              $code = ModifierCode::getIt(ModifierCode::GATE),

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierMutableParameterCode' in method 'I_get_null_for_unused_modifiers_for_every_modifier'.
              Open

                          foreach (ModifierMutableParameterCode::getPossibleValues() as $mutableParameterName) {

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_get_realms_affection'.
              Open

                      foreach (ModifierCode::getPossibleValues() as $modifierValue) {

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierMutableParameterCode' in method 'I_get_basic_difficulty_change_with_every_parameter'.
              Open

                          foreach (ModifierMutableParameterCode::getPossibleValues() as $mutableParameterName) {

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_not_add_non_zero_addition_to_unused_parameter'.
              Open

                              $modifierCode = ModifierCode::getIt(ModifierCode::INTERACTIVE_ILLUSION),

              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 using static access to class '\DrdPlus\Tables\Tables' in method 'I_can_create_it_with_non_spell_trait_as_spell_trait'.
              Open

                      new Modifier(ModifierCode::getIt(ModifierCode::TRANSPOSITION), Tables::getIt(), [], [new \DateTime()]);

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierMutableParameterCode' in method 'I_can_create_it_without_any_change_for_every_modifier'.
              Open

                          foreach (ModifierMutableParameterCode::getPossibleValues() as $mutableParameterName) {

              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 using static access to class '\Granam\String\StringTools' in method 'I_can_create_it_with_change_for_every_modifier'.
              Open

                              $getBaseParameter = StringTools::assembleGetterForName('base_' . $parameterName);

              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 using static access to class '\Granam\String\StringTools' in method 'I_can_create_it_without_any_change_for_every_modifier'.
              Open

                              $getParameterAddition = StringTools::assembleGetterForName($mutableParameterName) . 'Addition';

              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 using static access to class '\Granam\String\StringTools' in method 'I_get_null_for_unused_modifiers_for_every_modifier'.
              Open

                              $getParameterAddition = StringTools::assembleGetterForName($mutableParameterName) . 'Addition';

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierMutableParameterCode' in method 'I_can_create_it_with_change_for_every_modifier'.
              Open

                      foreach (ModifierMutableParameterCode::getPossibleValues() as $index => $parameterName) {

              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 using static access to class '\Granam\String\StringTools' in method 'addBaseParameterGetter'.
              Open

                      $getProperty = StringTools::assembleGetterForName($parameterName);

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_get_basic_difficulty_change_without_any_parameter'.
              Open

                      foreach (ModifierCode::getPossibleValues() as $modifierValue) {

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_create_it_with_change_for_every_modifier'.
              Open

                          $modifierCode = ModifierCode::getIt($modifierValue);

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_get_casting_rounds'.
              Open

                          $modifierCode = ModifierCode::getIt(ModifierCode::COLOR),

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_not_create_it_with_non_integer_addition'.
              Open

                          $code = ModifierCode::getIt(ModifierCode::INVISIBILITY),

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_can_not_create_it_with_non_integer_addition'.
              Open

                          ModifierCode::getIt(ModifierCode::TRANSPOSITION),

              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 using static access to class '\DrdPlus\Codes\Theurgist\ModifierCode' in method 'I_get_basic_difficulty_change_with_every_parameter'.
              Open

                      foreach (ModifierCode::getPossibleValues() as $modifierValue) {

              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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  public function I_can_get_casting_rounds()
                  {
                      $modifiersTable = $this->createModifiersTable();
                      $tables = $this->createTables($modifiersTable);
                      $modifier = new Modifier(
              Severity: Major
              Found in tests/Tables/Theurgist/Spells/ModifierTest.php and 1 other location - About 1 hr to fix
              tests/Tables/Theurgist/Spells/ModifierTest.php on lines 351..365

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 116.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  public function I_can_get_required_realm_for_modifier()
                  {
                      $modifiersTable = $this->createModifiersTable();
                      $tables = $this->createTables($modifiersTable);
                      $modifier = new Modifier(
              Severity: Major
              Found in tests/Tables/Theurgist/Spells/ModifierTest.php and 1 other location - About 1 hr to fix
              tests/Tables/Theurgist/Spells/ModifierTest.php on lines 332..346

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 116.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          foreach (ModifierMutableParameterCode::getPossibleValues() as $mutableParameterName) {
                              $parameter = $this->createExpectedParameter($mutableParameterName);
                              $this->addBaseParameterGetter($mutableParameterName, $modifierCode, $modifiersTable, $parameter);
                              $changedParameter = $this->createExpectedParameter($mutableParameterName);
                              $this->addExpectedAdditionSetter(0, $parameter, $changedParameter);
              Severity: Major
              Found in tests/Tables/Theurgist/Spells/ModifierTest.php and 1 other location - About 1 hr to fix
              tests/Tables/Theurgist/Spells/FormulaTest.php on lines 428..436

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 106.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                      $parameterClassBasename = ucfirst(StringTools::assembleMethodName($parameterName));

              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

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

                          $parameterDifficulties = [];

              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

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

                              $getParameterWithAddition = StringTools::assembleGetterForName($parameterName . '_with_addition');

              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

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

                          $difficultyChangeValue = 123 + 456 + array_sum($parameterDifficulties);

              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

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

                  private function createSpellTrait(int $difficultyChangeValue)

              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_can_get_required_realm_for_modifier is not named in camelCase.
              Open

                  public function I_can_get_required_realm_for_modifier()
                  {
                      $modifiersTable = $this->createModifiersTable();
                      $tables = $this->createTables($modifiersTable);
                      $modifier = new Modifier(

              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_non_spell_trait_as_spell_trait is not named in camelCase.
              Open

                  public function I_can_create_it_with_non_spell_trait_as_spell_trait()
                  {
                      $this->expectException(\DrdPlus\Tables\Theurgist\Spells\Exceptions\InvalidSpellTrait::class);
                      $this->expectExceptionMessageMatches('~DateTime~');
                      new Modifier(ModifierCode::getIt(ModifierCode::TRANSPOSITION), Tables::getIt(), [], [new \DateTime()]);

              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_without_any_change_for_every_modifier is not named in camelCase.
              Open

                  public function I_can_create_it_without_any_change_for_every_modifier()
                  {
                      foreach (ModifierCode::getPossibleValues() as $modifierValue) {
                          $modifierCode = ModifierCode::getIt($modifierValue);
                          $modifiersTable = $this->createModifiersTable();

              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_get_null_for_unused_modifiers_for_every_modifier is not named in camelCase.
              Open

                  public function I_get_null_for_unused_modifiers_for_every_modifier()
                  {
                      foreach (ModifierCode::getPossibleValues() as $modifierValue) {
                          $modifierCode = ModifierCode::getIt($modifierValue);
                          $modifiersTable = $this->createModifiersTable();

              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_addition_of_unknown_parameter is not named in camelCase.
              Open

                  public function I_can_not_create_it_with_addition_of_unknown_parameter()
                  {
                      $this->expectException(\DrdPlus\Tables\Theurgist\Spells\Exceptions\UnknownModifierParameter::class);
                      $this->expectExceptionMessageMatches('~useless~');
                      new Modifier(ModifierCode::getIt(ModifierCode::TRANSPOSITION), Tables::getIt(), ['useless' => 0], []);

              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_get_basic_difficulty_change_without_any_parameter is not named in camelCase.
              Open

                  public function I_get_basic_difficulty_change_without_any_parameter()
                  {
                      foreach (ModifierCode::getPossibleValues() as $modifierValue) {
                          $modifierCode = ModifierCode::getIt($modifierValue);
                          $modifiersTable = $this->createModifiersTable();

              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_change_for_every_modifier is not named in camelCase.
              Open

                  public function I_can_create_it_with_change_for_every_modifier()
                  {
                      $parameterChanges = [];
                      foreach (ModifierMutableParameterCode::getPossibleValues() as $index => $parameterName) {
                          $parameterChanges[$parameterName] = $index + 1; // 1...x

              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_get_casting_rounds is not named in camelCase.
              Open

                  public function I_can_get_casting_rounds()
                  {
                      $modifiersTable = $this->createModifiersTable();
                      $tables = $this->createTables($modifiersTable);
                      $modifier = new Modifier(

              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_get_realms_affection is not named in camelCase.
              Open

                  public function I_can_get_realms_affection()
                  {
                      foreach (ModifierCode::getPossibleValues() as $modifierValue) {
                          $modifier = new Modifier(
                              $modifierCode = ModifierCode::getIt($modifierValue),

              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_non_integer_addition is not named in camelCase.
              Open

                  public function I_can_not_create_it_with_non_integer_addition()
                  {
                      $this->expectException(\DrdPlus\Tables\Theurgist\Spells\Exceptions\InvalidValueForModifierParameter::class);
                      $this->expectExceptionMessageMatches('~0\.1~');
                      $modifiersTable = $this->createModifiersTable();

              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_get_basic_difficulty_change_with_every_parameter is not named in camelCase.
              Open

                  public function I_get_basic_difficulty_change_with_every_parameter()
                  {
                      foreach (ModifierCode::getPossibleValues() as $modifierValue) {
                          $modifierCode = ModifierCode::getIt($modifierValue);
                          $modifiersTable = $this->createModifiersTable();

              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_add_non_zero_addition_to_unused_parameter is not named in camelCase.
              Open

                  public function I_can_not_add_non_zero_addition_to_unused_parameter()
                  {
                      $this->expectException(\DrdPlus\Tables\Theurgist\Spells\Exceptions\UnknownModifierParameter::class);
                      $this->expectExceptionMessageMatches('~4~');
                      $modifiersTable = $this->createModifiersTable();

              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