HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

Avoid using undefined variables such as '$delta' which will lead to PHP notices.
Open

            $delta[$i] = (6.0 * $delta[$i] / ($xdata[$i + 1] - $xdata[$i - 1]) - $s * $delta[$i - 1]) / $p;
Severity: Minor
Found in src/util/Spline.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$delta' which will lead to PHP notices.
Open

            $delta[$i] = (6.0 * $delta[$i] / ($xdata[$i + 1] - $xdata[$i - 1]) - $s * $delta[$i - 1]) / $p;
Severity: Minor
Found in src/util/Spline.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$i' which will lead to PHP notices.
Open

            $tickPositions[$i++] = $aData[0];
Severity: Minor
Found in src/util/DateScaleUtils.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Method StrokeBackgroundGrad has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Method Create has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function Create($aPattern, $aColor, $aWeight = 1)
        {
            switch ($aPattern) {
                case BAND_RDIAG:
                    $obj = new RectPatternRDiag($aColor, $aWeight);
    Severity: Minor
    Found in src/graph/RectPatternFactory.php - About 1 hr to fix

      Method _normalizeTestGroup has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function _normalizeTestGroup($filename, &$ownFixtures = [], $example_title = 'file_iterator', $debug = false, $attributes = [])
          {
              $filename_meaningful = \explode('ex', $filename)[0];
      
              if ('file_iterator' === $example_title) {
      Severity: Minor
      Found in tests/UnitTestTrait.php - About 1 hr to fix

        Method _TransHor3D has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function _TransHor3D($aGdImg, $aHorizon = 100, $aSkewDist = 120, $aDir = SKEW3D_LEFT, $aMinSize = true, $aFillColor = '#FFFFFF', $aQuality = false, $aBorder = false, $aHorizonPos = 0.5)
        Severity: Major
        Found in src/image/ImgTrans.php - About 1 hr to fix

          Method Copy has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function Copy($fromImg, $toX, $toY, $fromX, $fromY, $toWidth, $toHeight, $fromWidth = -1, $fromHeight = -1)
          Severity: Major
          Found in src/image/Image.php - About 1 hr to fix

            Method DrawImageSmoothArc has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function DrawImageSmoothArc($im, $xc, $yc, $w, $h, $s, $e, $color, $style = null)
            Severity: Major
            Found in src/image/Image.php - About 1 hr to fix

              Method _TransVert3D has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function _TransVert3D($aGdImg, $aHorizon = 100, $aSkewDist = 120, $aDir = SKEW3D_DOWN, $aMinSize = true, $aFillColor = '#FFFFFF', $aQuality = false, $aBorder = false, $aHorizonPos = 0.5)
              Severity: Major
              Found in src/image/ImgTrans.php - About 1 hr to fix

                Method IndentedRectangle has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function IndentedRectangle($xt, $yt, $w, $h, $iw = 0, $ih = 0, $aCorner = 3, $aFillColor = '', $r = 4)
                Severity: Major
                Found in src/graph/Shape.php - About 1 hr to fix

                  Method StrokeNumber has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function StrokeNumber($aValStr, $aColor = 0, $aFileName = '')
                      {
                          if ($aColor < 0 || $aColor >= safe_count($this->iColorSchema)) {
                              $aColor = 0;
                          }
                  Severity: Minor
                  Found in src/image/DigitalLED74.php - About 1 hr to fix

                    Method GetIdxByName has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function GetIdxByName($aName, &$outFullName)
                        {
                            if (is_integer($aName)) {
                                $idx = $this->GetIdxByOrdinal($aName, $outFullName);
                    
                    
                    Severity: Minor
                    Found in src/image/FlagImages.php - About 1 hr to fix

                      Method FastStroke has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function FastStroke($img, $xscale, $yscale, $aStartPoint = 0, $exist_x = true)
                          {
                              // An optimized stroke for many data points with no extra
                              // features but 60% faster. You can't have values or line styles, or null
                              // values in plots.
                      Severity: Minor
                      Found in src/plot/LinePlot.php - About 1 hr to fix

                        Method Add has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function Add($aPlot)
                            {
                                if ($aPlot == null) {
                                    Util\JpGraphError::RaiseL(25010); //("Graph::Add() You tried to add a null plot to the graph.");
                                }
                        Severity: Minor
                        Found in src/graph/Graph.php - About 1 hr to fix

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

                              public function __construct($aWidth = null, $aHeight = null, $aCachedName = '', $aTimeOut = 0, $aInline = true)
                              {
                                  $this->iWidth  = $aWidth;
                                  $this->iHeight = $aHeight;
                          
                          
                          Severity: Minor
                          Found in src/graph/MGraph.php - About 1 hr to fix

                            Function __construct has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function __construct($aMatrix, $aIsobars = 10, $aColors = null)
                                {
                                    $this->nbrRows    = safe_count($aMatrix);
                                    $this->nbrCols    = safe_count($aMatrix[0]);
                                    $this->dataPoints = $aMatrix;
                            Severity: Minor
                            Found in src/plot/Contour.php - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function Stroke($img, $aaoption = 0)
                                {
                                    // Stroke the pie but don't stroke values
                                    $tmp               = $this->value->show;
                                    $this->value->show = false;
                            Severity: Minor
                            Found in src/plot/PiePlotC.php - About 1 hr 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 adjustDataPointValues has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function adjustDataPointValues()
                                {
                                    $ni = safe_count($this->isobarValues);
                                    for ($k = 0; $k < $ni; ++$k) {
                                        $ib = $this->isobarValues[$k];
                            Severity: Minor
                            Found in src/plot/Contour.php - About 1 hr 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 Min has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function Min()
                                {
                                    $nmax                 = 0;
                                    list($xmin, $ysetmin) = $this->plots[0]->Min();
                                    for ($i = 0; $i < safe_count($this->plots); ++$i) {
                            Severity: Minor
                            Found in src/plot/AccBarPlot.php - About 1 hr 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

                            Severity
                            Category
                            Status
                            Source
                            Language