HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

The method _fileCheck has a boolean flag argument $debug, which is a certain sign of a Single Responsibility Principle violation.
Open

    private function _fileCheck($filename, &$ownFixtures = [], $debug = false, $dims = [])
Severity: Minor
Found in tests/ImgTest.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

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

Function resetEdgeMatrices has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function resetEdgeMatrices()
    {
        for ($k = 0; $k < 2; ++$k) {
            for ($i = 0; $i <= $this->nbrRows; ++$i) {
                for ($j = 0; $j <= $this->nbrCols; ++$j) {
Severity: Minor
Found in src/plot/Contour.php - About 25 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 getHeight has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHeight($aImg)
    {
        $scaling = 1; //$this->iAntiAlias ? 2 : 1 ;
        if ($this->iSize > 0 && $this->iSize < 1) {
            $this->iSize *= min($aImg->width, $aImg->height);
Severity: Minor
Found in src/plot/WindrosePlot.php - About 25 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 getWidth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getWidth($aImg)
    {
        $scaling = 1; //$this->iAntiAlias ? 2 : 1 ;
        if ($this->iSize > 0 && $this->iSize < 1) {
            $this->iSize *= min($aImg->width, $aImg->height);
Severity: Minor
Found in src/plot/WindrosePlot.php - About 25 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 Stroke has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function Stroke($img, $xscale, $yscale)
    {
        if (safe_count($this->manualIsobarColors) > 0) {
            $this->contourColor = $this->manualIsobarColors;
            if (safe_count($this->manualIsobarColors) != $this->nbrContours) {
Severity: Minor
Found in src/plot/ContourPlot.php - About 25 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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($aPos, $aLabel, $aStart, $aEnd, $aCaption = '', $aHeightFactor = 0.6)
    {
        parent::__construct();
        $this->iStart = $aStart;
        // Is the end date given as a date or as number of days added to start date?
Severity: Minor
Found in src/plot/GanttBar.php - About 25 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 AddCSIMPoly has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function AddCSIMPoly($aPts)
    {
        $coords = round($aPts[0]) . ', ' . round($aPts[1]);
        $n      = safe_count($aPts) / 2;
        for ($i = 1; $i < $n; ++$i) {
Severity: Minor
Found in src/plot/PlotMark.php - About 25 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 Legend has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function Legend($graph)
    {
        if ($this->legend != '') {
            if ($this->filled && !$this->fillgrad) {
                $graph->legend->Add(
Severity: Minor
Found in src/plot/LinePlot.php - About 25 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 CakeSlice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function CakeSlice($xc, $yc, $w, $h, $s, $e, $fillcolor = '', $arccolor = '')
    {
        $s  = round($s);
        $e  = round($e);
        $w  = round($w);
Severity: Minor
Found in src/image/Image.php - About 25 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 DrawLine has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function DrawLine($im, $x1, $y1, $x2, $y2, $weight, $color)
    {
        if ($weight == 1) {
            return imageline($im, $x1, $y1, $x2, $y2, $color);
        }
Severity: Minor
Found in src/image/Image.php - About 25 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 CreateRawCanvas has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function CreateRawCanvas($aWidth = 0, $aHeight = 0)
    {
        $aWidth *= SUPERSAMPLING_SCALE;
        $aHeight *= SUPERSAMPLING_SCALE;

Severity: Minor
Found in src/image/Image.php - About 25 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 SetPadding has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function SetPadding($aArgR1, $aC1 = null, $aR2 = null, $aC2 = null, $aPad = null)
    {
        if ($aC1 !== null && $aR2 !== null && $aC2 !== null && $aPad !== null) {
            $this->_chkR($aArgR1);
            $this->_chkC($aC1);
Severity: Minor
Found in src/text/GTextTable.php - About 25 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 SetTextOrientation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function SetTextOrientation($aArgR1, $aC1 = null, $aR2 = null, $aC2 = null, $aO = null)
    {
        if ($aC1 !== null && $aR2 !== null && $aC2 !== null && $aPad !== null) {
            $this->_chkR($aArgR1);
            $this->_chkC($aC1);
Severity: Minor
Found in src/text/GTextTable.php - About 25 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 Calc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function Calc()
    {
        $this->icalculated = true;

        $n   = safe_count($this->ix);
Severity: Minor
Found in src/util/LinearRegression.php - About 25 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 toString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function toString()
    {
        $t = '<table border=1 cellspacing=0 cellpadding=0>';
        for ($i = 0; $i < $this->iSize[0]; ++$i) {
            $t .= '<tr>';
Severity: Minor
Found in src/text/GTextTable.php - About 25 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 SetColor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function SetColor($aArgR1, $aC1 = null, $aR2 = null, $aC2 = null, $aArg = null)
    {
        if ($aC1 !== null && $aR2 !== null && $aC2 !== null && $aArg !== null) {
            $this->_chkR($aArgR1);
            $this->_chkC($aC1);
Severity: Minor
Found in src/text/GTextTable.php - About 25 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 InitScaleConstants has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function InitScaleConstants()
    {
        // Setup scale constants
        if ($this->yscale) {
            $this->yscale->InitConstants($this->img);
Severity: Minor
Found in src/graph/Graph.php - About 25 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 SetBackgroundImage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function SetBackgroundImage($aFileName, $aBgType = BGIMG_FILLPLOT, $aImgFormat = 'auto')
    {
        // Get extension to determine image type
        if ($aImgFormat == 'auto') {
            $e = explode('.', $aFileName);
Severity: Minor
Found in src/graph/Graph.php - About 25 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 IntCalcTicksFreeze has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function IntCalcTicksFreeze($maxsteps, $min, $max, $a)
    {
        // Same as IntCalcTick but don't change min/max values
        $diff = $max - $min;
        if ($diff == 0) {
Severity: Minor
Found in src/graph/LinearScale.php - About 25 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 InitConstants has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function InitConstants($img)
    {
        if ($this->type == 'x') {
            $this->world_abs_size = $img->width - $img->left_margin - $img->right_margin;
            $this->off            = $img->left_margin;
Severity: Minor
Found in src/graph/LinearScale.php - About 25 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

Severity
Category
Status
Source
Language