HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

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

        if ($this->iStartAlign !== false) {
            if ($this->iStartAlign >= 30) {
                $adjstart = $this->AdjStartDate($aStartTime, $this->iStartAlign - 30);
            } elseif ($this->iStartAlign >= 20) {
                $adjstart = $this->AdjStartDate($aStartTime, false, $this->iStartAlign - 20);
Severity: Major
Found in src/graph/DateScale.php and 3 other locations - About 1 hr to fix
src/graph/DateScale.php on lines 480..488
src/graph/DateScale.php on lines 489..497
src/graph/DateScale.php on lines 508..516

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

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 ($this->iStartTimeAlign !== false) {
            if ($this->iStartTimeAlign >= 30) {
                $adjstart = $this->AdjStartTime($aStartTime, $this->iStartTimeAlign - 30);
            } elseif ($this->iStartTimeAlign >= 20) {
                $adjstart = $this->AdjStartTime($aStartTime, false, $this->iStartTimeAlign - 20);
Severity: Major
Found in src/graph/DateScale.php and 3 other locations - About 1 hr to fix
src/graph/DateScale.php on lines 489..497
src/graph/DateScale.php on lines 499..507
src/graph/DateScale.php on lines 508..516

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

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 ($this->iEndAlign !== false) {
            if ($this->iEndAlign >= 30) {
                $adjend = $this->AdjEndDate($aEndTime, $this->iEndAlign - 30);
            } elseif ($this->iEndAlign >= 20) {
                $adjend = $this->AdjEndDate($aEndTime, false, $this->iEndAlign - 20);
Severity: Major
Found in src/graph/DateScale.php and 3 other locations - About 1 hr to fix
src/graph/DateScale.php on lines 480..488
src/graph/DateScale.php on lines 489..497
src/graph/DateScale.php on lines 499..507

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

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 LineInterpolate has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function LineInterpolate(&$aData)
    {
        $n = safe_count($aData);
        $i = 0;

Severity: Minor
Found in src/plot/AccLinePlot.php - About 1 hr to fix

    Method GetCSIMareas has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function GetCSIMareas()
        {
            if (!$this->iHasStroked) {
                $this->Stroke(_CSIM_SPECIALFILE);
            }
    Severity: Minor
    Found in src/graph/Graph.php - About 1 hr to fix

      Method StrokeFrame has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function StrokeFrame()
          {
              if (!$this->doframe) {
                  return;
              }
      Severity: Minor
      Found in src/graph/Graph.php - About 1 hr to fix

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

                if (abs($min - $max) > 2) {
                    // Then get tick marks as 2:s 2, 20, ...
                    if ($majend) {
                        list($num2steps, $adj2min, $adj2max, $maj2step) = $this->IntCalcTicks($maxsteps, $min, $max, 5);
                    } else {
        Severity: Major
        Found in src/graph/LinearScale.php and 1 other location - About 1 hr to fix
        src/graph/LinearScale.php on lines 210..221

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

        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

                if (abs($min - $max) > 5) {
                    // Then get tickmarks as 5:s 5, 50, 500, ...
                    if ($majend) {
                        list($num5steps, $adj5min, $adj5max, $maj5step) = $this->IntCalcTicks($maxsteps, $min, $max, 2);
                    } else {
        Severity: Major
        Found in src/graph/LinearScale.php and 1 other location - About 1 hr to fix
        src/graph/LinearScale.php on lines 197..208

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

        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 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function Stroke($img, $pos, $scale, $startangle)
            {
                $nbrpnts = safe_count($this->data);
                $astep   = 2 * M_PI / $nbrpnts;
                $a       = $startangle;
        Severity: Minor
        Found in src/plot/RadarPlot.php - About 1 hr to fix

          Method imageSmoothArc has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function imageSmoothArc(&$img, $cx, $cy, $w, $h, $color, $start, $stop)
              {
                  // Originally written from scratch by Ulrich Mierendorff, 06/2006
                  // Rewritten and improved, 04/2007, 07/2007
                  // compared to old version:
          Severity: Minor
          Found in src/image/Image.php - About 1 hr to fix

            Method Color has 45 lines of code (exceeds 25 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 1 hr to fix

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

                  public function Stroke($img, $pos, $scale, $startangle)
                  {
                      $nbrpnts = safe_count($this->data);
                      $astep   = 2 * M_PI / $nbrpnts;
                      $a       = $startangle;
              Severity: Minor
              Found in src/graph/RadarGrid.php - About 1 hr to fix

                Method SetScale has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function SetScale($aAxisType, $aYMin = 1, $aYMax = 1, $aXMin = 1, $aXMax = 1)
                    {
                        $this->axtype = $aAxisType;
                
                        if ($aYMax < $aYMin || $aXMax < $aXMin) {
                Severity: Minor
                Found in src/graph/Graph.php - About 1 hr to fix

                  Method _StrokeAxisTitle has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function _StrokeAxisTitle($pos, $aAxisAngle, $title)
                      {
                          $this->title->Set($title);
                          $marg = 6 + $this->title->margin;
                          $xt   = round(($this->scale->world_abs_size + $marg) * cos($aAxisAngle) + $this->scale->scale_abs[0]);
                  Severity: Minor
                  Found in src/graph/RadarAxis.php - About 1 hr to fix

                    Method _SetPatternHelper has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _SetPatternHelper($aPattern, &$aPatternValue, &$aDensity)
                        {
                            switch ($aPattern) {
                                case PATTERN_DIAG1:
                                    $aPatternValue = 1;
                    Severity: Minor
                    Found in src/plot/BarPlot.php - About 1 hr to fix

                      Method GetWidth has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function GetWidth($aImg, $aUseTabs = false, $aTabExtraMargin = 1.1)
                          {
                              $extra_margin = 4;
                              $aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
                              if (is_string($this->iText)) {
                      Severity: Minor
                      Found in src/text/TextProperty.php - About 1 hr to fix

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

                                    if ($adj > 1) {
                                        $m = ($adj - 1.0) * (255 - min(255, min($r, min($g, $b))));
                        
                                        return [min(255, $r + $m), min(255, $g + $m), min(255, $b + $m), $alpha];
                                    }
                        Severity: Major
                        Found in src/util/RGB.php and 1 other location - About 1 hr to fix
                        src/image/RGB.php on lines 541..545

                        Duplicated Code

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

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

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

                        Tuning

                        This issue has a mass of 116.

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

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

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

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

                        Refactorings

                        Further Reading

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

                                            if ($start > $i * M_PI / 2 && $y < $yStart) {
                                                $diffColor2 = imagecolorexactalpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error2);
                                                $x2         = $_x2;
                                                if (!$aaStartX) {
                                                    imagesetpixel($img, $cx + $xp * ($x2 + 1) + $xa, $cy + $yp * ($y) + $ya, $diffColor2);
                        Severity: Major
                        Found in src/image/Image.php and 1 other location - About 1 hr to fix
                        src/image/Image.php on lines 2412..2427

                        Duplicated Code

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

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

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

                        Tuning

                        This issue has a mass of 116.

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

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

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

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

                        Refactorings

                        Further Reading

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

                                    if ($xStart > $xStop) {
                                        $error1 = $_y1 - (int) ($_y1);
                                        $error2 = 1 - $_y2 + (int) $_y2;
                                        $_y1    = $_y1 - $error1;
                                        $_y2    = $_y2 + $error2;
                        Severity: Major
                        Found in src/image/Image.php and 1 other location - About 1 hr to fix
                        src/image/Image.php on lines 2333..2343

                        Duplicated Code

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

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

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

                        Tuning

                        This issue has a mass of 116.

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

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

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

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

                        Refactorings

                        Further Reading

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

                                    if ($adj > 1) {
                                        $m = ($adj - 1.0) * (255 - min(255, min($r, min($g, $b))));
                        
                                        return [min(255, $r + $m), min(255, $g + $m), min(255, $b + $m), $alpha];
                                    }
                        Severity: Major
                        Found in src/image/RGB.php and 1 other location - About 1 hr to fix
                        src/util/RGB.php on lines 531..535

                        Duplicated Code

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

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

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

                        Tuning

                        This issue has a mass of 116.

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

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

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

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

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language