HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

Method Stroke has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function Stroke($aImg, $x = null, $y = null)
    {
        if (is_numeric($x)) {
            $this->x = round($x);
        }
Severity: Major
Found in src/text/Text.php - About 2 hrs to fix

    Method Stroke has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function Stroke($aImg, $ax = -1, $ay = -1)
        {
            // To position the super script correctly we need different
            // cases to handle the alignmewnt specified since that will
            // determine how we can interpret the x,y coordinates
    Severity: Major
    Found in src/text/SuperScriptText.php - About 2 hrs to fix

      Function Color has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function Color($aColor)
          {
              if (is_string($aColor)) {
                  $matches = [];
                  // this regex will parse a color string and fill the $matches array as such:
      Severity: Minor
      Found in src/util/RGB.php - About 2 hrs 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

      Function File has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function File($family, $style = FS_NORMAL, $font_path = null)
          {
              $fam = @$this->font_files[$family];
              if (!$fam) {
                  Util\JpGraphError::RaiseL(25046, $family); //("Specified TTF font family (id=$family) is unknown or does not exist. Please note that TTF fonts are not distributed with JpGraph for copyright reasons. You can find the MS TTF WEB-fonts (arial, courier etc) for download at http://corefonts.sourceforge.net/");
      Severity: Minor
      Found in src/text/TTF.php - About 2 hrs 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

      Function StrokeMonths has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function StrokeMonths($aYCoord, $getHeight = false)
          {
              if ($this->month->iShowLabels) {
                  $img = $this->iImg;
                  $img->SetFont($this->month->iFFamily, $this->month->iFStyle, $this->month->iFSize);
      Severity: Minor
      Found in src/graph/GanttScale.php - About 2 hrs 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

      Function Stroke has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function Stroke($aStrokeFileName = '')
          {
              // Start by adjusting the margin so that potential titles will fit.
              $this->AdjustMarginsForTitles();
      
      
      Severity: Minor
      Found in src/graph/PolarGraph.php - About 2 hrs 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 3 locations. Consider refactoring.
      Open

              if ($this->subsubtitle->halign == 'center') {
                  $this->subsubtitle->Center(0, $this->img->width, $y);
              } elseif ($this->subsubtitle->halign == 'left') {
                  $this->subsubtitle->SetPos($this->subsubtitle->margin + 2, $y);
              } elseif ($this->subsubtitle->halign == 'right') {
      Severity: Major
      Found in src/graph/Graph.php and 2 other locations - About 2 hrs to fix
      src/graph/Graph.php on lines 2619..2629
      src/graph/Graph.php on lines 2634..2645

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

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

              if ($this->title->halign == 'center') {
                  $this->title->Center(0, $this->img->width, $y);
              } elseif ($this->title->halign == 'left') {
                  $this->title->SetPos($this->title->margin + 2, $y);
              } elseif ($this->title->halign == 'right') {
      Severity: Major
      Found in src/graph/Graph.php and 2 other locations - About 2 hrs to fix
      src/graph/Graph.php on lines 2634..2645
      src/graph/Graph.php on lines 2650..2661

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

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

              if ($this->subtitle->halign == 'center') {
                  $this->subtitle->Center(0, $this->img->width, $y);
              } elseif ($this->subtitle->halign == 'left') {
                  $this->subtitle->SetPos($this->subtitle->margin + 2, $y);
              } elseif ($this->subtitle->halign == 'right') {
      Severity: Major
      Found in src/graph/Graph.php and 2 other locations - About 2 hrs to fix
      src/graph/Graph.php on lines 2619..2629
      src/graph/Graph.php on lines 2650..2661

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

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

              if ($aC1 !== null && $aR2 !== null && $aC2 !== null && $aPad !== null) {
                  $this->_chkR($aArgR1);
                  $this->_chkC($aC1);
                  $this->_chkR($aR2);
                  $this->_chkC($aC2);
      Severity: Major
      Found in src/text/GTextTable.php and 3 other locations - About 2 hrs to fix
      src/text/GTextTable.php on lines 270..281
      src/text/GTextTable.php on lines 378..389
      src/text/GTextTable.php on lines 614..625

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

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

              if ($aC1 !== null && $aR2 !== null && $aC2 !== null && $aArg !== null) {
                  $this->_chkR($aArgR1);
                  $this->_chkC($aC1);
                  $this->_chkR($aR2);
                  $this->_chkC($aC2);
      Severity: Major
      Found in src/text/GTextTable.php and 3 other locations - About 2 hrs to fix
      src/text/GTextTable.php on lines 270..281
      src/text/GTextTable.php on lines 324..335
      src/text/GTextTable.php on lines 378..389

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

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

              if ($aC1 !== null && $aR2 !== null && $aC2 !== null && $aPad !== null) {
                  $this->_chkR($aArgR1);
                  $this->_chkC($aC1);
                  $this->_chkR($aR2);
                  $this->_chkC($aC2);
      Severity: Major
      Found in src/text/GTextTable.php and 3 other locations - About 2 hrs to fix
      src/text/GTextTable.php on lines 324..335
      src/text/GTextTable.php on lines 378..389
      src/text/GTextTable.php on lines 614..625

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

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

              if ($aC1 !== null && $aR2 !== null && $aC2 !== null && $aArg !== null) {
                  $this->_chkR($aArgR1);
                  $this->_chkC($aC1);
                  $this->_chkR($aR2);
                  $this->_chkC($aC2);
      Severity: Major
      Found in src/text/GTextTable.php and 3 other locations - About 2 hrs to fix
      src/text/GTextTable.php on lines 270..281
      src/text/GTextTable.php on lines 324..335
      src/text/GTextTable.php on lines 614..625

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

      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

      File LinearTicks.php has 285 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * JPGraph v4.0.3
       */
      Severity: Minor
      Found in src/graph/LinearTicks.php - About 2 hrs to fix

        Method StrokeMinutes has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function StrokeMinutes($aYCoord, $getHeight = false)
            {
                $img = $this->iImg;
                $xt  = $img->left_margin + $this->iLabelWidth;
                $yt  = $aYCoord + $img->top_margin;
        Severity: Major
        Found in src/graph/GanttScale.php - About 2 hrs to fix

          Method CreateSimple has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function CreateSimple($data, $constrains = [], $progress = [])
              {
                  $num = safe_count($data);
                  for ($i = 0; $i < $num; ++$i) {
                      switch ($data[$i][1]) {
          Severity: Major
          Found in src/graph/GanttGraph.php - About 2 hrs to fix

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

                        case DSUTILS_YEAR5:
                            $y = self::$startyear;
                            while ($y <= self::$endyear) {
                                self::$tickPositions[$i++] = mktime(0, 0, 0, 1, 1, $y);
                                for ($k = 0; $k < 4; ++$k) {
            Severity: Major
            Found in src/util/DateScaleUtils.php and 1 other location - About 2 hrs to fix
            src/util/DateScaleUtils.php on lines 77..90

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

            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

                        case DSUTILS_YEAR2:
                            $y = self::$startyear;
                            while ($y <= self::$endyear) {
                                self::$tickPositions[$i++] = mktime(0, 0, 0, 1, 1, $y);
                                for ($k = 0; $k < 1; ++$k) {
            Severity: Major
            Found in src/util/DateScaleUtils.php and 1 other location - About 2 hrs to fix
            src/util/DateScaleUtils.php on lines 91..104

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

            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

            Method Stroke has 70 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function Stroke($aStrokeFileName = '')
                {
                    // If the filename is the predefined value = '_csim_special_'
                    // we assume that the call to stroke only needs to do enough
                    // to correctly generate the CSIM maps.
            Severity: Major
            Found in src/graph/GanttGraph.php - About 2 hrs to fix

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

              <?php
              
              /**
               * JPGraph v4.0.3
               */
              Severity: Major
              Found in src/graph/RectPatternVert.php and 1 other location - About 2 hrs to fix
              src/graph/RectPatternHor.php on lines 1..31

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

              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

              Severity
              Category
              Status
              Source
              Language