jaroslavtyc/drd-plus-codes

View on GitHub

Showing 57 of 591 total issues

Method translateTo has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function translateTo(string $languageCode, $amount = 1): string
    {
        $code = $this->getValue();
        $translations = $this->getTranslations($languageCode);
        /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
Severity: Minor
Found in Codes/Partials/TranslatableCode.php - About 1 hr to fix

    Method fetchTranslations has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function fetchTranslations(): array
        {
            $translations = [
                'cs' => [
                    'one' => [
    Severity: Minor
    Found in Codes/Theurgist/ProfileCode.php - About 1 hr to fix

      Method getEnergeticSpellCodes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getEnergeticSpellCodes(): array
          {
              return [
                  self::MAROON,
                  self::BURN,
      Severity: Minor
      Found in Codes/Wizard/SpellCode.php - About 1 hr to fix

        Method getMaterialSpellCodes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getMaterialSpellCodes(): array
            {
                return [
                    self::NOT_EVEN_HIT,
                    self::TODAY_YOU_WILL_TRY_IT_WITHOUT_WEAPON,
        Severity: Minor
        Found in Codes/Wizard/SpellCode.php - About 1 hr to fix

          Method getInvestigativeSpellCodes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getInvestigativeSpellCodes(): array
              {
                  return [
                      self::GOOD_TABLE,
                      self::WHERE_IS_MY_PIPE,
          Severity: Minor
          Found in Codes/Wizard/SpellCode.php - About 1 hr to fix

            Method getMentalSpellCodes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function getMentalSpellCodes(): array
                {
                    return [
                        self::COLORS_AND_SHAPES,
                        self::ENJOY_YOURSELF,
            Severity: Minor
            Found in Codes/Wizard/SpellCode.php - About 1 hr to fix

              Method getTimeSpaceSpellCodes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getTimeSpaceSpellCodes(): array
                  {
                      return [
                          self::MAGIC_ARMOR,
                          self::PROJECTILE,
              Severity: Minor
              Found in Codes/Wizard/SpellCode.php - About 1 hr to fix

                Method getVitalSpellCodes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function getVitalSpellCodes(): array
                    {
                        return [
                            self::QUINT_OF_SENSES,
                            self::TORTURE,
                Severity: Minor
                Found in Codes/Wizard/SpellCode.php - About 1 hr to fix

                  Method I_can_ask_code_if_is_specific_weapon_type has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function I_can_ask_code_if_is_specific_weapon_type()
                      {
                          $questions = [
                              'isBow', 'isCrossbow', 'isThrowingWeapon',
                          ];
                  Severity: Minor
                  Found in tests/Codes/Armaments/RangedWeaponCodeTest.php - About 1 hr to fix

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

                        protected function fetchTranslations(): array
                        {
                            return [
                                'en' => [
                                    self::ASTRONOMY => [self::$ONE => 'astronomy'],
                    Severity: Minor
                    Found in Codes/Skills/PsychicalSkillCode.php - About 1 hr to fix

                      Method fetchTranslations has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function fetchTranslations(): array
                          {
                              return [
                                  'en' => [
                                      self::HORSE => [self::$ONE => 'horse', self::$FEW => 'horses', self::$MANY => 'horses'],
                      Severity: Minor
                      Found in Codes/Transport/RidingAnimalCode.php - About 1 hr to fix

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

                            public function I_get_whispered_current_code_as_return_value_of_factory_method()
                            {
                                foreach ($this->getCodeClasses() as $codeClass) {
                                    $reflectionClass = new \ReflectionClass($codeClass);
                                    $classBaseName = preg_replace('~^.*[\\\](\w+)$~', '$1', $codeClass);
                        Severity: Minor
                        Found in tests/Codes/AllCodesTest.php - About 1 hr to fix

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

                              public static function getPossibleValues(): array
                              {
                                  return [
                                      self::BARRIER_VENUS,
                                      self::BARRIER_MARS,
                          Severity: Minor
                          Found in Codes/Theurgist/ProfileCode.php - About 1 hr to fix

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

                                public function All_public_constants_can_be_given_by_getter()
                                {
                                    $constants = $this->sutReflection->getConstants();
                                    self::assertEquals($constants, array_unique($constants));
                                    asort($constants);
                            Severity: Minor
                            Found in tests/Codes/Partials/TranslatableExtendableCodeTest.php - About 1 hr to fix

                              Function getTranslations has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function getTranslations(string $requiredLanguageCode): array
                                  {
                                      if ((self::$translations[static::class] ?? null) === null) {
                                          $translations = self::$customCodeTranslations[static::class] ?? [];
                                          if (count($translations) === 0) {
                              Severity: Minor
                              Found in Codes/Partials/TranslatableExtendableCode.php - About 1 hr 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

                              Method I_can_get_all_codes_at_once_or_by_same_named_constant has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function I_can_get_all_codes_at_once_or_by_same_named_constant()
                                  {
                                      self::assertSame(
                                          $expectedValues = [
                                              // throwing weapons
                              Severity: Minor
                              Found in tests/Codes/Armaments/RangedWeaponCodeTest.php - About 1 hr to fix

                                Method getPossibleValues has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public static function getPossibleValues(): array
                                    {
                                        return [
                                            self::ARMOR_WEARING,
                                            self::ATHLETICS,
                                Severity: Minor
                                Found in Codes/Skills/PhysicalSkillCode.php - About 1 hr to fix

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

                                      public static function getRaceToSubRaceValues(): array
                                      {
                                          return [
                                              RaceCode::HUMAN => [
                                                  self::COMMON,
                                  Severity: Minor
                                  Found in Codes/SubRaceCode.php - About 1 hr to fix

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

                                        private function getExpectedRacesToSubRaces(): array
                                        {
                                            return [
                                                'human' => [
                                                    'common',
                                    Severity: Minor
                                    Found in tests/Codes/SubRaceCodeTest.php - About 1 hr to fix

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

                                          public function I_can_extended_it_by_custom_translatable_code()
                                          {
                                              /** @var WeaponCode $sutClass */
                                              $sutClass = self::getSutClass();
                                              $reflectionClass = new \ReflectionClass($sutClass);
                                      Severity: Minor
                                      Found in tests/Codes/Armaments/WeaponCodeTest.php - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language