HuasoFoundries/jpgraph

View on GitHub

Showing 706 of 6,805 total issues

Avoid deeply nested control flow statements.
Open

                        if ($this->iObj[$j]->iVPos == $vpos) {
                            $targetobj = $j;
                        }
Severity: Major
Found in src/graph/GanttGraph.php - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            switch ($this->iObj[$i]->constraints[$k]->iConstrainType) {
                                case CONSTRAIN_ENDSTART:
                                    if ($c1[1] < $c2[1]) {
                                        $link = new Image\GanttLink($c1[2], $c1[3], $c2[0], $c2[1]);
                                    } else {
    Severity: Major
    Found in src/graph/GanttGraph.php - About 45 mins to fix

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

          public function Stroke($aImg, $aXLeft, $aYTop, $aXRight, $aYBottom, $aUseTextHeight = false)
      Severity: Minor
      Found in src/graph/GanttActivityInfo.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if (!(($i == $n || $i == 0) && $this->hour->iShowLabels && $this->hour->grid->iShow)) {
                                    $img->SetColor($this->minute->grid->iColor);
                                    $img->SetLineWeight($this->minute->grid->iWeight);
                                    $img->Line($x, $yt, $x, $yb);
                                    $this->minute->grid->Stroke($img, $x, $yb, $x, $img->height - $img->bottom_margin);
        Severity: Major
        Found in src/graph/GanttScale.php - About 45 mins to fix

          Function _strokeBackgroundImage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function _strokeBackgroundImage()
              {
                  if ($this->background_image == '') {
                      return;
                  }
          Severity: Minor
          Found in src/graph/MGraph.php - About 45 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

          Function GetBarMinMax has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function GetBarMinMax()
              {
                  $start = 0;
                  $n     = safe_count($this->iObj);
                  while ($start < $n && $this->iObj[$start]->GetMaxDate() === false) {
          Severity: Minor
          Found in src/graph/GanttGraph.php - About 45 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

          Function GetMaxActInfoColWidth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function GetMaxActInfoColWidth()
              {
                  $n = safe_count($this->iObj);
                  if ($n == 0) {
                      return;
          Severity: Minor
          Found in src/graph/GanttGraph.php - About 45 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

          Function StrokeTexts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function StrokeTexts()
              {
                  // Stroke any user added text objects
                  if ($this->texts != null) {
                      $n = safe_count($this->texts);
          Severity: Minor
          Found in src/graph/GanttGraph.php - About 45 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

          Avoid deeply nested control flow statements.
          Open

                                  if ($day == 6 || $day == 0) {
                                      $img->PushColor($this->day->iWeekendBackgroundColor);
                                      if ($this->iUsePlotWeekendBackground) {
                                          $img->FilledRectangle($x, $yt + $this->day->iFrameWeight, $x + $width, $img->height - $img->bottom_margin);
                                      } else {
          Severity: Major
          Found in src/graph/GanttScale.php - About 45 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    if ($this->grad && $this->legend != '' && !$this->fill) {
                        $color = [$this->grad_fromcolor, $this->grad_tocolor];
                        // In order to differentiate between gradients and cooors specified as an Image\RGB triple
                        $graph->legend->Add(
                            $this->legend,
            Severity: Major
            Found in src/plot/BarPlot.php - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                          if ($aFormat == 'jpeg' && !($supported & IMG_JPG)) {
                              $tst = false;
                          } elseif ($aFormat == 'png' && !($supported & IMG_PNG)) {
                              $tst = false;
                          } elseif ($aFormat == 'gif' && !($supported & IMG_GIF)) {
              Severity: Major
              Found in src/image/Image.php - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                                    if (($aColor[0] >= 0 && $aColor[0] <= 255) &&
                                        ($aColor[1] >= 0 && $aColor[1] <= 255) &&
                                        ($aColor[2] >= 0 && $aColor[2] <= 255)) {
                                        return sprintf('#%02x%02x%02x', $aColor[0], $aColor[1], $aColor[2]);
                                    }
                Severity: Major
                Found in src/image/RGB.php - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                                      if (($aColor[0] >= 0 && $aColor[0] <= 255) &&
                                          ($aColor[1] >= 0 && $aColor[1] <= 255) &&
                                          ($aColor[2] >= 0 && $aColor[2] <= 255)) {
                                          return sprintf('#%02x%02x%02x', $aColor[0], $aColor[1], $aColor[2]);
                                      }
                  Severity: Major
                  Found in src/util/RGB.php - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if (($this->supress_zerolabel && $l == 0) || ($this->supress_first && $aIdx == 0) || ($this->supress_last && $aIdx == $aNbrTicks - 1)) {
                                $l = '';
                            }
                    Severity: Major
                    Found in src/graph/LinearTicks.php - About 40 mins to fix

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

                          public function _StrokeLegend($aImg, $x, $y, $scaling = 1, $aReturnWidth = false)
                      Severity: Minor
                      Found in src/plot/WindrosePlot.php - About 35 mins to fix

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

                            public function GetColArray($from_color, $to_color, $arr_size, &$colors, $numcols = 100)
                        Severity: Minor
                        Found in src/plot/Gradient.php - About 35 mins to fix

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

                              public function SetConstrain($aRow, $aType, $aColor = 'black', $aArrowSize = ARROW_S2, $aArrowType = ARROWT_SOLID)
                          Severity: Minor
                          Found in src/plot/GanttPlotObject.php - About 35 mins to fix

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

                                public function __construct($aDate, $aTitle = '', $aColor = 'darkred', $aWeight = 2, $aStyle = 'solid')
                            Severity: Minor
                            Found in src/plot/GanttVLine.php - About 35 mins to fix

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

                                  public function __construct($aDataMatrix, $aIsobar = 10, $aFactor = 1, $aInvert = false, $aIsobarColors = [])
                              Severity: Minor
                              Found in src/plot/ContourPlot.php - About 35 mins to fix

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

                                    public function __construct($aFile = '', $aX = 0, $aY = 0, $aScale = 1.0, $aMix = 100)
                                Severity: Minor
                                Found in src/plot/IconPlot.php - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language