HuasoFoundries/jpgraph

View on GitHub

Showing 706 of 6,805 total issues

Function Stroke has a Cognitive Complexity of 29 (exceeds 5 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: Minor
Found in src/text/SuperScriptText.php - About 4 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 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function Stroke($aImg, $aX, $aY, $aWidth, $aHeight)
    {
        // If this is a merged cell we only stroke if it is the parent cell.
        // The parent cell holds the merged cell block
        if ($this->iMerged && ($this->iRow != $this->iPRow || $this->iCol != $this->iPCol)) {
Severity: Minor
Found in src/text/GTextTableCell.php - About 4 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 AutoScale has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function AutoScale($img, $aStartTime, $aEndTime, $aNumSteps, $_adummy = false)
    {
        // We need to have one dummy argument to make the signature of AutoScale()
        // identical to LinearScale::AutoScale
        if ($aStartTime == $aEndTime) {
Severity: Minor
Found in src/graph/DateScale.php - About 4 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

File FlagImages.php has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * JPGraph v4.0.3
 */
Severity: Minor
Found in src/image/FlagImages.php - About 4 hrs to fix

    Method StrokeLabels has 105 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function StrokeLabels($aPos, $aMinor = false, $aAbsLabel = false)
        {
            if (is_array($this->label_color) && safe_count($this->label_color) > 3) {
                $this->ticks_label_colors = $this->label_color;
                $this->img->SetColor($this->label_color[0]);
    Severity: Major
    Found in src/graph/Axis.php - About 4 hrs to fix

      Function doYearly has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function doYearly($aType, $aMinor = false)
          {
              $i = 0;
              $j = 0;
              $m = self::$startmonth;
      Severity: Minor
      Found in src/util/DateScaleUtils.php - About 4 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 AutoScale has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public function AutoScale($img, $min, $max, $maxsteps, $majend = true)
          {
              if (!is_numeric($min) || !is_numeric($max)) {
                  Util\JpGraphError::Raise(25044);
              }
      Severity: Minor
      Found in src/graph/LinearScale.php - About 4 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 CreateSimple has a Cognitive Complexity of 28 (exceeds 5 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: Minor
      Found in src/graph/GanttGraph.php - About 4 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

      LineTest has 32 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class LineTest extends \Codeception\Test\Unit
      {
          use Amenadiel\JpGraph\UnitTest\UnitTestTrait;
      
          public static $fixTures = [];
      Severity: Minor
      Found in tests/LineTest.php - About 4 hrs to fix

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

            public function Stroke($aImg, $aX, $aY, $aWidth, $aHeight)
            {
                // If this is a merged cell we only stroke if it is the parent cell.
                // The parent cell holds the merged cell block
                if ($this->iMerged && ($this->iRow != $this->iPRow || $this->iCol != $this->iPCol)) {
        Severity: Major
        Found in src/text/GTextTableCell.php - About 3 hrs to fix

          Method Stroke has 97 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/RadarGraph.php - About 3 hrs to fix

            Method DoDateAutoScale has 96 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function DoDateAutoScale($aStartTime, $aEndTime, $aDensity = 0, $aAdjust = true)
                {
                    // Format of array
                    // array ( Decision point,  array( array( Major-scale-step-array ),
                    //       array( Minor-scale-step-array ),
            Severity: Major
            Found in src/graph/DateScale.php - About 3 hrs to fix

              PiePlot has 31 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class PiePlot
              {
                  public $posx                     = 0.5;
                  public $posy                     = 0.5;
                  public $is_using_plot_theme      = false;
              Severity: Minor
              Found in src/plot/PiePlot.php - About 3 hrs to fix

                AxisPrototype has 31 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class AxisPrototype
                {
                    public $scale;
                    public $img;
                    public $hide        = false;
                Severity: Minor
                Found in src/graph/AxisPrototype.php - About 3 hrs to fix

                  Function _doAutoTickPos has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function _doAutoTickPos($aScale)
                      {
                          $maj_step_abs = $aScale->scale_factor * $this->major_step;
                          $min_step_abs = $aScale->scale_factor * $this->minor_step;
                  
                  
                  Severity: Minor
                  Found in src/graph/LinearTicks.php - About 3 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

                  Method ImgData_Squares has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function ImgData_Squares()
                      {
                          /*
                           *sq_lblue.png
                           */
                  Severity: Major
                  Found in src/image/ImgData_Squares.php - About 3 hrs to fix

                    Method IntAutoScale has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function IntAutoScale($img, $min, $max, $maxsteps, $majend = true)
                        {
                            // Make sure limits are integers
                            $min = floor($min);
                            $max = ceil($max);
                    Severity: Major
                    Found in src/graph/LinearScale.php - About 3 hrs to fix

                      Method doAutoscaleXAxis has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function doAutoscaleXAxis()
                          {
                              $aPlots = array_filter($this->plots, function ($plot) {
                                  //\Kint::dump($plot, $plot instanceof Plot\Plot);
                                  return $plot instanceof Plot\Plot;
                      Severity: Major
                      Found in src/graph/Graph.php - About 3 hrs to fix

                        Consider simplifying this complex logical expression.
                        Open

                                        if (($da <= 90 && ($a <= 90 && $ne > 90)) ||
                                            (($da <= 180 && $da > 90) && (($a < 90 || $a >= 270) && $ne > 90))) {
                                            $split = 90;
                                        } elseif (($da <= 90 && ($a <= 270 && $ne > 270)) ||
                                            (($da <= 180 && $da > 90) && ($a >= 90 && $a < 270 && ($a + $da) > 270))) {
                        Severity: Critical
                        Found in src/plot/PiePlot3D.php - About 3 hrs to fix

                          Text has 30 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Text //extends Graph
                          {
                              public $t;
                              public $x      = 0;
                              public $y      = 0;
                          Severity: Minor
                          Found in src/text/Text.php - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language