dolejska-daniel/riot-api-datadragon

View on GitHub
src/DataDragonAPI/DataDragonAPI.php

Summary

Maintainability
F
1 wk
Test Coverage

DataDragonAPI has 84 functions (exceeds 20 allowed). Consider refactoring.
Open

class DataDragonAPI
{
    /**
     *   Settings constants.
     */
Severity: Major
Found in src/DataDragonAPI/DataDragonAPI.php - About 1 day to fix

    File DataDragonAPI.php has 688 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Copyright (C) 2016-2023  Daniel Dolejška
     *
    Severity: Major
    Found in src/DataDragonAPI/DataDragonAPI.php - About 1 day to fix

      Method getFromSprite has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function getFromSprite( string $source, int $x, int $y, int $w = 48, int $h = 48, array $attributes = [] ): Html
      Severity: Minor
      Found in src/DataDragonAPI/DataDragonAPI.php - About 45 mins to fix

        Method getStaticDataFileUrl has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static function getStaticDataFileUrl( string $dataType, string $key = null, $locale = 'en_US', $version = null, string $fragment = null ): string
        Severity: Minor
        Found in src/DataDragonAPI/DataDragonAPI.php - About 35 mins to fix

          Function loadStaticData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected static function loadStaticData( string $url, callable $postprocess = null, bool $data_from_postprocess = false ): array
              {
                  // Try loading from cache
                  $data = self::loadCachedStaticData($url);
                  if ($data->isHit()) return $data->get();
          Severity: Minor
          Found in src/DataDragonAPI/DataDragonAPI.php - About 25 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

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

              public static function getChampionLoading( string $champion_name, int $skin = 0, array $attributes = [] ): Html
              {
                  $attrs = array_merge([ 'alt' => $champion_name ], self::getSetting(self::SET_CUSTOM_IMG_ATTRS, []), $attributes);
                  $attrs['class'] = implode(' ', [
                      self::getSetting(self::SET_DEFAULT_CLASS),
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 1 other location - About 4 hrs to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 612..624

          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 178.

          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 static function getChampionSplash( string $champion_name, int $skin = 0, array $attributes = [] ): Html
              {
                  $attrs = array_merge([ 'alt' => $champion_name ], self::getSetting(self::SET_CUSTOM_IMG_ATTRS, []), $attributes);
                  $attrs['class'] = implode(' ', [
                      self::getSetting(self::SET_DEFAULT_CLASS),
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 1 other location - About 4 hrs to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 667..679

          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 178.

          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 8 locations. Consider refactoring.
          Open

              public static function getSpellIcon( string $spell_name, array $attributes = [] ): Html
              {
                  self::checkInit();
          
                  $attrs = array_merge([ 'alt'   => $spell_name ], self::getSetting(self::SET_CUSTOM_IMG_ATTRS, []), $attributes);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 7 other locations - About 4 hrs to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 724..738
          src/DataDragonAPI/DataDragonAPI.php on lines 905..919
          src/DataDragonAPI/DataDragonAPI.php on lines 972..986
          src/DataDragonAPI/DataDragonAPI.php on lines 1030..1044
          src/DataDragonAPI/DataDragonAPI.php on lines 1088..1102
          src/DataDragonAPI/DataDragonAPI.php on lines 1221..1235
          src/DataDragonAPI/DataDragonAPI.php on lines 1279..1293

          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 176.

          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 8 locations. Consider refactoring.
          Open

              public static function getMasteryIcon( int $mastery_id, array $attributes = [] ): Html
              {
                  self::checkInit();
          
                  $attrs = array_merge([ 'alt'   => $mastery_id ], self::getSetting(self::SET_CUSTOM_IMG_ATTRS, []), $attributes);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 7 other locations - About 4 hrs to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 724..738
          src/DataDragonAPI/DataDragonAPI.php on lines 845..859
          src/DataDragonAPI/DataDragonAPI.php on lines 905..919
          src/DataDragonAPI/DataDragonAPI.php on lines 972..986
          src/DataDragonAPI/DataDragonAPI.php on lines 1088..1102
          src/DataDragonAPI/DataDragonAPI.php on lines 1221..1235
          src/DataDragonAPI/DataDragonAPI.php on lines 1279..1293

          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 176.

          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 8 locations. Consider refactoring.
          Open

              public static function getScoreboardIcon( string $name, array $attributes = [] ): Html
              {
                  self::checkInit();
          
                  $attrs = array_merge([ 'alt' => $name ], self::getSetting(self::SET_CUSTOM_IMG_ATTRS, []), $attributes);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 7 other locations - About 4 hrs to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 724..738
          src/DataDragonAPI/DataDragonAPI.php on lines 845..859
          src/DataDragonAPI/DataDragonAPI.php on lines 905..919
          src/DataDragonAPI/DataDragonAPI.php on lines 972..986
          src/DataDragonAPI/DataDragonAPI.php on lines 1030..1044
          src/DataDragonAPI/DataDragonAPI.php on lines 1088..1102
          src/DataDragonAPI/DataDragonAPI.php on lines 1221..1235

          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 176.

          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 8 locations. Consider refactoring.
          Open

              public static function getRuneIcon( int $rune_id, array $attributes = [] ): Html
              {
                  self::checkInit();
          
                  $attrs = array_merge([ 'alt'   => $rune_id ], self::getSetting(self::SET_CUSTOM_IMG_ATTRS, []), $attributes);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 7 other locations - About 4 hrs to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 724..738
          src/DataDragonAPI/DataDragonAPI.php on lines 845..859
          src/DataDragonAPI/DataDragonAPI.php on lines 905..919
          src/DataDragonAPI/DataDragonAPI.php on lines 972..986
          src/DataDragonAPI/DataDragonAPI.php on lines 1030..1044
          src/DataDragonAPI/DataDragonAPI.php on lines 1221..1235
          src/DataDragonAPI/DataDragonAPI.php on lines 1279..1293

          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 176.

          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 8 locations. Consider refactoring.
          Open

              public static function getChampionIcon( string $champion_name, array $attributes = [] ): Html
              {
                  self::checkInit();
          
                  $attrs = array_merge([ 'alt' => $champion_name ], self::getSetting(self::SET_CUSTOM_IMG_ATTRS, []), $attributes);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 7 other locations - About 4 hrs to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 845..859
          src/DataDragonAPI/DataDragonAPI.php on lines 905..919
          src/DataDragonAPI/DataDragonAPI.php on lines 972..986
          src/DataDragonAPI/DataDragonAPI.php on lines 1030..1044
          src/DataDragonAPI/DataDragonAPI.php on lines 1088..1102
          src/DataDragonAPI/DataDragonAPI.php on lines 1221..1235
          src/DataDragonAPI/DataDragonAPI.php on lines 1279..1293

          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 176.

          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 8 locations. Consider refactoring.
          Open

              public static function getMinimap( int $map_id, array $attributes = [] ): Html
              {
                  self::checkInit();
          
                  $attrs = array_merge([ 'alt' => $map_id ], self::getSetting(self::SET_CUSTOM_IMG_ATTRS, []), $attributes);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 7 other locations - About 4 hrs to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 724..738
          src/DataDragonAPI/DataDragonAPI.php on lines 845..859
          src/DataDragonAPI/DataDragonAPI.php on lines 905..919
          src/DataDragonAPI/DataDragonAPI.php on lines 972..986
          src/DataDragonAPI/DataDragonAPI.php on lines 1030..1044
          src/DataDragonAPI/DataDragonAPI.php on lines 1088..1102
          src/DataDragonAPI/DataDragonAPI.php on lines 1279..1293

          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 176.

          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 8 locations. Consider refactoring.
          Open

              public static function getChampionPassiveIcon( $image_name, array $attributes = [] ): Html
              {
                  self::checkInit();
          
                  $attrs = array_merge([ 'alt'   => $image_name ], self::getSetting(self::SET_CUSTOM_IMG_ATTRS, []), $attributes);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 7 other locations - About 4 hrs to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 724..738
          src/DataDragonAPI/DataDragonAPI.php on lines 845..859
          src/DataDragonAPI/DataDragonAPI.php on lines 972..986
          src/DataDragonAPI/DataDragonAPI.php on lines 1030..1044
          src/DataDragonAPI/DataDragonAPI.php on lines 1088..1102
          src/DataDragonAPI/DataDragonAPI.php on lines 1221..1235
          src/DataDragonAPI/DataDragonAPI.php on lines 1279..1293

          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 176.

          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 8 locations. Consider refactoring.
          Open

              public static function getItemIcon( int $item_id, array $attributes = [] ): Html
              {
                  self::checkInit();
          
                  $attrs = array_merge([ 'alt'   => $item_id ], self::getSetting(self::SET_CUSTOM_IMG_ATTRS, []), $attributes);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 7 other locations - About 4 hrs to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 724..738
          src/DataDragonAPI/DataDragonAPI.php on lines 845..859
          src/DataDragonAPI/DataDragonAPI.php on lines 905..919
          src/DataDragonAPI/DataDragonAPI.php on lines 1030..1044
          src/DataDragonAPI/DataDragonAPI.php on lines 1088..1102
          src/DataDragonAPI/DataDragonAPI.php on lines 1221..1235
          src/DataDragonAPI/DataDragonAPI.php on lines 1279..1293

          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 176.

          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 static function getReforgedRunePathIconO( StaticReforgedRunePathDto $runePath, array $attributes = [] ): Html
              {
                  $attrs = array_merge([ 'alt'   => $runePath->name ], self::getSetting(self::SET_CUSTOM_IMG_ATTRS, []), $attributes);
                  $attrs['class'] = implode(' ', [
                      self::getSetting(self::SET_DEFAULT_CLASS),
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 1 other location - About 4 hrs to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1144..1156

          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 174.

          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 static function getReforgedRuneIconO( StaticReforgedRuneDto $rune, array $attributes = [] ): Html
              {
                  $attrs = array_merge([ 'alt'   => $rune->name ], self::getSetting(self::SET_CUSTOM_IMG_ATTRS, []), $attributes);
                  $attrs['class'] = implode(' ', [
                      self::getSetting(self::SET_DEFAULT_CLASS),
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 1 other location - About 4 hrs to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1179..1191

          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 174.

          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

              protected static function _summonerSpell( string $url, array $data )
              {
                  $url .= self::STATIC_SUMMONERSPELLS_BY_KEY;
                  $data_by_key = $data;
                  $data_by_key['data'] = [];
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 1 other location - About 1 hr to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1656..1668

          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

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

              protected static function _champion( string $url, array $data )
              {
                  $url .= self::STATIC_CHAMPION_BY_KEY;
                  $data_by_key = $data;
                  $data_by_key['data'] = [];
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 1 other location - About 1 hr to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1634..1646

          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

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

              public static function getStaticSummonerSpells( string $locale = 'en_US', string $version = null, bool $data_by_key = false ) : array
              {
                  $url = self::getStaticDataFileUrl(self::STATIC_SUMMONERSPELLS, null, $locale, $version, $data_by_key ? self::STATIC_SUMMONERSPELLS_BY_KEY : null);
                  return self::loadStaticData($url, [DataDragonAPI::class, "_summonerSpell"], $data_by_key);
              }
          Severity: Minor
          Found in src/DataDragonAPI/DataDragonAPI.php and 1 other location - About 55 mins to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1308..1312

          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 98.

          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 static function getStaticChampions( string $locale = 'en_US', string $version = null, bool $data_by_key = false ) : array
              {
                  $url = self::getStaticDataFileUrl(self::STATIC_CHAMPIONS, null, $locale, $version, $data_by_key ? self::STATIC_CHAMPION_BY_KEY : null);
                  return self::loadStaticData($url, [DataDragonAPI::class, "_champion"], $data_by_key);
              }
          Severity: Minor
          Found in src/DataDragonAPI/DataDragonAPI.php and 1 other location - About 55 mins to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1553..1557

          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 98.

          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 static function getStaticSummonerSpellById( string $summonerspell_id, string $locale = 'en_US', string $version = null ) : array
              {
                  $data = self::getStaticSummonerSpells($locale, $version, true);
                  if (isset($data['data'][$summonerspell_id]) == false)
                      throw new ArgumentException("Summoner spell with ID '$summonerspell_id' was not found.", 404);
          Severity: Minor
          Found in src/DataDragonAPI/DataDragonAPI.php and 1 other location - About 45 mins to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1360..1367

          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 96.

          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 static function getStaticChampionByKey( int $champion_key, string $locale = 'en_US', string $version = null ) : array
              {
                  $data = self::getStaticChampions($locale, $version, true);
                  if (isset($data['data'][$champion_key]) == false)
                      throw new ArgumentException("Champion with key '$champion_key' was not found.", 404);
          Severity: Minor
          Found in src/DataDragonAPI/DataDragonAPI.php and 1 other location - About 45 mins to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1602..1609

          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 96.

          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 5 locations. Consider refactoring.
          Open

              public static function getStaticSummonerSpell( string $summonerspell_key, string $locale = 'en_US', string $version = null ) : array
              {
                  $data = self::getStaticSummonerSpells($locale, $version);
                  if (isset($data['data'][$summonerspell_key]) == false)
                      throw new ArgumentException("Summoner spell with key '$summonerspell_key' was not found.", 404);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 4 other locations - About 30 mins to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1340..1347
          src/DataDragonAPI/DataDragonAPI.php on lines 1392..1399
          src/DataDragonAPI/DataDragonAPI.php on lines 1462..1469
          src/DataDragonAPI/DataDragonAPI.php on lines 1494..1501

          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 90.

          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 5 locations. Consider refactoring.
          Open

              public static function getStaticChampionById( string $champion_id, string $locale = 'en_US', string $version = null ) : array
              {
                  $data = self::getStaticChampions($locale, $version);
                  if (isset($data['data'][$champion_id]) == false)
                      throw new ArgumentException("Champion with ID '$champion_id' was not found.", 404);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 4 other locations - About 30 mins to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1392..1399
          src/DataDragonAPI/DataDragonAPI.php on lines 1462..1469
          src/DataDragonAPI/DataDragonAPI.php on lines 1494..1501
          src/DataDragonAPI/DataDragonAPI.php on lines 1568..1575

          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 90.

          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 5 locations. Consider refactoring.
          Open

              public static function getStaticItem( int $item_id, string $locale = 'en_US', string $version = null ) : array
              {
                  $data = self::getStaticItems($locale, $version);
                  if (isset($data['data'][$item_id]) == false)
                      throw new ArgumentException("Item with ID '$item_id' was not found.", 404);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 4 other locations - About 30 mins to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1340..1347
          src/DataDragonAPI/DataDragonAPI.php on lines 1462..1469
          src/DataDragonAPI/DataDragonAPI.php on lines 1494..1501
          src/DataDragonAPI/DataDragonAPI.php on lines 1568..1575

          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 90.

          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 5 locations. Consider refactoring.
          Open

              public static function getStaticRune( int $rune_id, string $locale = 'en_US', string $version = null) : array
              {
                  $data = self::getStaticRunes($locale, $version);
                  if (isset($data['data'][$rune_id]) == false)
                      throw new ArgumentException("Rune with ID '$rune_id' was not found.", 404);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 4 other locations - About 30 mins to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1340..1347
          src/DataDragonAPI/DataDragonAPI.php on lines 1392..1399
          src/DataDragonAPI/DataDragonAPI.php on lines 1462..1469
          src/DataDragonAPI/DataDragonAPI.php on lines 1568..1575

          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 90.

          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 5 locations. Consider refactoring.
          Open

              public static function getStaticMastery( int $mastery_id, string $locale = 'en_US', string $version = null ) : array
              {
                  $data = self::getStaticMasteries($locale, $version);
                  if (isset($data['data'][$mastery_id]) == false)
                      throw new ArgumentException("Mastery with ID '$mastery_id' was not found.", 404);
          Severity: Major
          Found in src/DataDragonAPI/DataDragonAPI.php and 4 other locations - About 30 mins to fix
          src/DataDragonAPI/DataDragonAPI.php on lines 1340..1347
          src/DataDragonAPI/DataDragonAPI.php on lines 1392..1399
          src/DataDragonAPI/DataDragonAPI.php on lines 1494..1501
          src/DataDragonAPI/DataDragonAPI.php on lines 1568..1575

          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 90.

          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

          There are no issues that match your filters.

          Category
          Status