HuasoFoundries/jpgraph

View on GitHub
src/image/ImgData_Balls.php

Summary

Maintainability
F
1 wk
Test Coverage

Method __construct has 819 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct()
    {
        /*
         * File: bl_red.png
         */
Severity: Major
Found in src/image/ImgData_Balls.php - About 4 days to fix

    File ImgData_Balls.php has 882 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * JPGraph v4.0.3
     */
    Severity: Major
    Found in src/image/ImgData_Balls.php - About 2 days to fix

      The class ImgData_Balls has 17 fields. Consider redesigning ImgData_Balls to keep the number of fields under 15.
      Open

      class ImgData_Balls extends ImgData
      {
          protected $name = 'Round Balls';
          protected $an   = [MARK_IMG_LBALL     => 'imgdata_large',
              MARK_IMG_MBALL                    => 'imgdata_small',
      Severity: Minor
      Found in src/image/ImgData_Balls.php by phpmd

      TooManyFields

      Since: 0.1

      Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

      Example

      class Person {
         protected $one;
         private $two;
         private $three;
         [... many more fields ...]
      }

      Source https://phpmd.org/rules/codesize.html#toomanyfields

      The class ImgData_Balls has 1051 lines of code. Current threshold is 1000. Avoid really long classes.
      Open

      class ImgData_Balls extends ImgData
      {
          protected $name = 'Round Balls';
          protected $an   = [MARK_IMG_LBALL     => 'imgdata_large',
              MARK_IMG_MBALL                    => 'imgdata_small',
      Severity: Minor
      Found in src/image/ImgData_Balls.php by phpmd

      The method __construct() has 981 lines of code. Current threshold is set to 100. Avoid really long methods.
      Open

          public function __construct()
          {
              /*
               * File: bl_red.png
               */
      Severity: Minor
      Found in src/image/ImgData_Balls.php by phpmd

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

              $this->imgdata_large[3][1] =
                  'iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAMAAAAM7l6QAAADAF' .
                  'BMVEUAAADOzs7Gxsa9vb21tbXOxsbOzsbGzsb3///O1ta1vb2c' .
                  'paVSWlpKWlpSY2ve5+97hIze7/9aY2vO5/9zhJRaa3tSY3PGzt' .
                  'aMlJxrc3tja3NKUlpCSlK1vcZze4RSWmPW5/+Upb3G3v9zhJxS' .
      Severity: Major
      Found in src/image/ImgData_Balls.php and 1 other location - About 4 hrs to fix
      src/image/ImgData_Balls.php on lines 391..431

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

      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

              $this->imgdata_large[8][1] =
                  'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAABm' .
                  'JLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsRAAALEQF/ZF+RAAAA' .
                  'B3RJTUUH0wMMFjM4kcoDJQAABVlJREFUeNq9ll2MJFUVx3/11V' .
                  'Vd/TE9vU0v4zLDwJIF16jBqLAPhsRXEiDqg0QTJiQSjcSNvCzw' .
      Severity: Major
      Found in src/image/ImgData_Balls.php and 1 other location - About 4 hrs to fix
      src/image/ImgData_Balls.php on lines 206..246

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

      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

              $this->imgdata_large[7][1] =
                  'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAAB2l' .
                  'BMVEX////////3///v///n/+/e99bW/+/W99bO786/v7++vr69' .
                  '/96999a7wb24vbu1/9a1zqW1u7itxrWosq6l772l1qWlxrWlxq' .
                  '2lva2cxpSU562U3q2UxqWUvaWUpZyM77WM57WMvYyMtZyMrZyM' .
      Severity: Major
      Found in src/image/ImgData_Balls.php and 1 other location - About 2 hrs to fix
      src/image/ImgData_Balls.php on lines 170..200

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

      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

              $this->imgdata_large[2][1] =
                  'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAAB2l' .
                  'BMVEX//////////+///+f//9b//8b//73//7X//63//6X//5T/' .
                  '/4z//4T//3P//2v//1r//0r//0L//zH//yn//yH//xj//xD//w' .
                  'j//wD/90L/9zn/9zH/9xj/9xD/9wj/9wD39yn37zn37zH37yH3' .
      Severity: Major
      Found in src/image/ImgData_Balls.php and 1 other location - About 2 hrs to fix
      src/image/ImgData_Balls.php on lines 355..385

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

      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

              $this->imgdata_large[6][1] =
                  'iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAABoV' .
                  'BMVEX////Gzs7GvbXGrZTGpXu9nHO1nHO1nIy9taXGxs7GtaXO' .
                  'nHPGlFrGjEq9hEq1hEqte0Klczmcazmce1KtnIzGxsbGvb3OlF' .
                  'LOlFq9hFKte0qcc0KUYzGEWimMc1K9ta3OnGvOnGPWnGO9jFq9' .
      Severity: Major
      Found in src/image/ImgData_Balls.php and 1 other location - About 2 hrs to fix
      src/image/ImgData_Balls.php on lines 92..121

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

      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

              $this->imgdata_large[0][1] =
                  'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAAByF' .
                  'BMVEX/////////xsb/vb3/lIz/hIT/e3v/c3P/c2v/a2v/Y2P/' .
                  'UlL/Skr/SkL/Qjn/MTH/MSn/KSn/ISH/IRj/GBj/GBD/EBD/EA' .
                  'j/CAj/CAD/AAD3QkL3MTH3KSn3KSH3GBj3EBD3CAj3AAD1zMzv' .
      Severity: Major
      Found in src/image/ImgData_Balls.php and 1 other location - About 2 hrs to fix
      src/image/ImgData_Balls.php on lines 320..349

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

      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

              $this->imgdata_large[5][1] =
                  'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAABO1' .
                  'BMVEX////////3///39/fv7+/e5+fW3t7Wzs7WxsbG1tbGzsbG' .
                  'xsbDxMS/v7++wMC+v7+9zsa9xsa9vb29tbW9ra29pa24uLi1xs' .
                  'a1vb21tbWxtrattbWmpqalra2cra2cpaWcnJycjIyUpaWUnJyU' .
      Severity: Major
      Found in src/image/ImgData_Balls.php and 1 other location - About 1 hr to fix
      src/image/PredefIcons.php on lines 256..281

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

      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 variables with short names like $an. Configured minimum length is 3.
      Open

          protected $an   = [MARK_IMG_LBALL     => 'imgdata_large',
              MARK_IMG_MBALL                    => 'imgdata_small',
              MARK_IMG_SBALL                    => 'imgdata_xsmall',
              MARK_IMG_BALL                     => 'imgdata_xsmall', ];
      Severity: Minor
      Found in src/image/ImgData_Balls.php by phpmd

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      Method name "ImgData_Balls::GetImg" is not in camel caps format
      Open

          public function GetImg($aMark, $aIdx)
      Severity: Minor
      Found in src/image/ImgData_Balls.php by phpcodesniffer

      Line exceeds 120 characters; contains 123 characters
      Open

              'green'                    => 8, 'purple'    => 4, 'red'   => 0, 'gray'      => 5, 'silver' => 3, 'yellow' => 2, ];
      Severity: Minor
      Found in src/image/ImgData_Balls.php by phpcodesniffer

      Class name "ImgData_Balls" is not in camel caps format
      Open

      class ImgData_Balls extends ImgData
      Severity: Minor
      Found in src/image/ImgData_Balls.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status