HuasoFoundries/jpgraph

View on GitHub
src/plot/Contour.php

Summary

Maintainability
D
2 days
Test Coverage

Function getIsobars has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public function getIsobars()
    {
        $this->adjustDataPointValues();

        for ($isobar = 0; $isobar < $this->nbrIsobars; ++$isobar) {
Severity: Minor
Found in src/plot/Contour.php - About 6 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

The class Contour has an overall complexity of 64 which is very high. The configured complexity threshold is 50.
Open

class Contour
{
    private $dataPoints   = [];
    private $nbrCols      = 0;
    private $nbrRows      = 0;
Severity: Minor
Found in src/plot/Contour.php by phpmd

Method getIsobars has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getIsobars()
    {
        $this->adjustDataPointValues();

        for ($isobar = 0; $isobar < $this->nbrIsobars; ++$isobar) {
Severity: Major
Found in src/plot/Contour.php - About 2 hrs to fix

    Function CalculateColors has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public function CalculateColors()
        {
            if ($this->highcontrast) {
                if ($this->highcontrastbw) {
                    for ($ib = 0; $ib < $this->nbrIsobars; ++$ib) {
    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 __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 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

    Consider simplifying this complex logical expression.
    Open

                            if ($midval == $ib) {
                                // Orientation "+"
                                $n1 = 0;
                                $n2 = 1;
                                $n3 = 2;
    Severity: Major
    Found in src/plot/Contour.php - About 1 hr to fix

      Function getCrossingCoord has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getCrossingCoord($aRow, $aCol, $aEdgeDir, $aIsobarVal)
          {
              // In order to avoid numerical problem when two vertices are very close
              // we have to check and avoid dividing by close to zero denumerator.
              if ($aEdgeDir == HORIZ_EDGE) {
      Severity: Minor
      Found in src/plot/Contour.php - About 55 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 ($midval == $ib) {
                                  // Orientation "+"
                                  $n1 = 0;
                                  $n2 = 1;
                                  $n3 = 2;
      Severity: Major
      Found in src/plot/Contour.php - About 45 mins to fix

        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

        The method getIsobars() has an NPath complexity of 390. The configured NPath complexity threshold is 200.
        Open

            public function getIsobars()
            {
                $this->adjustDataPointValues();
        
                for ($isobar = 0; $isobar < $this->nbrIsobars; ++$isobar) {
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        NPathComplexity

        Since: 0.1

        The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

        Example

        class Foo {
            function bar() {
                // lots of complicated code
            }
        }

        Source https://phpmd.org/rules/codesize.html#npathcomplexity

        The method getIsobars() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10.
        Open

            public function getIsobars()
            {
                $this->adjustDataPointValues();
        
                for ($isobar = 0; $isobar < $this->nbrIsobars; ++$isobar) {
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        CyclomaticComplexity

        Since: 0.1

        Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

        Example

        // Cyclomatic Complexity = 11
        class Foo {
        1   public function example() {
        2       if ($a == $b) {
        3           if ($a1 == $b1) {
                        fiddle();
        4           } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                        fiddle();
                    }
        5       } elseif ($c == $d) {
        6           while ($c == $d) {
                        fiddle();
                    }
        7        } elseif ($e == $f) {
        8           for ($n = 0; $n < $h; $n++) {
                        fiddle();
                    }
                } else {
                    switch ($z) {
        9               case 1:
                            fiddle();
                            break;
        10              case 2:
                            fiddle();
                            break;
        11              case 3:
                            fiddle();
                            break;
                        default:
                            fiddle();
                            break;
                    }
                }
            }
        }

        Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

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

                                    $this->getCrossingCoord($neigh[$n1][0], $neigh[$n1][1], $neigh[$n1][2], $ib),
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n3][0], $neigh[$n3][1], $neigh[$n3][2], $ib),
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n1][0], $neigh[$n1][1], $neigh[$n1][2], $ib),
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n2][0], $neigh[$n2][1], $neigh[$n2][2], $ib), ];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n2][0], $neigh[$n2][1], $neigh[$n2][2], $ib), ];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n1][0], $neigh[$n1][1], $neigh[$n1][2], $ib),
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n3][0], $neigh[$n3][1], $neigh[$n3][2], $ib),
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n2][0], $neigh[$n2][1], $neigh[$n2][2], $ib), ];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                $neigh[$n++] = [$row, $col, HORIZ_EDGE];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n4][0], $neigh[$n4][1], $neigh[$n4][2], $ib), ];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                $neigh[$n++] = [$row + 1, $col, HORIZ_EDGE];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n1][0], $neigh[$n1][1], $neigh[$n1][2], $ib),
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n1][0], $neigh[$n1][1], $neigh[$n1][2], $ib),
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n1][0], $neigh[$n1][1], $neigh[$n1][2], $ib),
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n2][0], $neigh[$n2][1], $neigh[$n2][2], $ib), ];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n4][0], $neigh[$n4][1], $neigh[$n4][2], $ib), ];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                $neigh[$n++] = [$row, $col + 1, VERT_EDGE];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n4][0], $neigh[$n4][1], $neigh[$n4][2], $ib), ];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n2][0], $neigh[$n2][1], $neigh[$n2][2], $ib), ];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                $neigh[$n++] = [$row, $col, VERT_EDGE];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n2][0], $neigh[$n2][1], $neigh[$n2][2], $ib), ];
        Severity: Minor
        Found in src/plot/Contour.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 '$neigh' which will lead to PHP notices.
        Open

                                    $this->getCrossingCoord($neigh[$n3][0], $neigh[$n3][1], $neigh[$n3][2], $ib),
        Severity: Minor
        Found in src/plot/Contour.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

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

            public function UseHighContrastColor($aFlg = true, $aBW = false)
        Severity: Minor
        Found in src/plot/Contour.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

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

            public function SetInvert($aFlg = true)
        Severity: Minor
        Found in src/plot/Contour.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

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

            public function UseHighContrastColor($aFlg = true, $aBW = false)
        Severity: Minor
        Found in src/plot/Contour.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

        Avoid using static access to class '\Amenadiel\JpGraph\Util\JpGraphError' in method '__construct'.
        Open

                        Util\JpGraphError::RaiseL(28002);
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid using static access to class '\Amenadiel\JpGraph\Image\RGB' in method 'CalculateColors'.
        Open

                        $this->isobarColors[$ib] = Image\RGB::GetSpectrum($v);
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid assigning values to variables in if clauses and the like (line '116', column '18').
        Open

            public function getMinMaxVal()
            {
                $min = $this->dataPoints[0][0];
                $max = $this->dataPoints[0][0];
                for ($i = 0; $i < $this->nbrRows; ++$i) {
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid using static access to class '\Amenadiel\JpGraph\Util\JpGraphError' in method 'isobarHCrossing'.
        Open

                    Util\JpGraphError::RaiseL(28003, $aCol);
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid using static access to class '\Amenadiel\JpGraph\Util\JpGraphError' in method 'isobarVCrossing'.
        Open

                    Util\JpGraphError::RaiseL(28005, $aRow);
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        The method getCrossingCoord uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $d = abs($this->dataPoints[$aRow][$aCol] - $this->dataPoints[$aRow + 1][$aCol]);
                    if ($d > 0.001) {
                        $ycoord = $aRow + abs($aIsobarVal - $this->dataPoints[$aRow][$aCol]) / $d;
                    } else {
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

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

        Avoid using static access to class '\Amenadiel\JpGraph\Util\JpGraphError' in method 'isobarVCrossing'.
        Open

                    Util\JpGraphError::RaiseL(28006, $aCol);
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        The method __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    // Determine the isobar values automatically
                    $this->nbrIsobars = $aIsobars;
                    list($min, $max)  = $this->getMinMaxVal();
                    $stepSize         = ($max - $min) / $aIsobars;
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

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

        The method CalculateColors uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $n    = $this->nbrIsobars;
                    $v    = 0;
                    $step = 1 / ($this->nbrIsobars - 1);
                    for ($ib = 0; $ib < $this->nbrIsobars; ++$ib) {
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

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

        Avoid assigning values to variables in if clauses and the like (line '120', column '18').
        Open

            public function getMinMaxVal()
            {
                $min = $this->dataPoints[0][0];
                $max = $this->dataPoints[0][0];
                for ($i = 0; $i < $this->nbrRows; ++$i) {
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid using static access to class '\Amenadiel\JpGraph\Util\JpGraphError' in method '__construct'.
        Open

                        Util\JpGraphError::RaiseL(28001);
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        The method getCrossingCoord uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        $xcoord = $aCol;
                    }
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

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

        The method getCrossingCoord uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        $ycoord = $aRow;
                    }
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

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

        Avoid using static access to class '\Amenadiel\JpGraph\Util\JpGraphError' in method 'isobarHCrossing'.
        Open

                    Util\JpGraphError::RaiseL(28004, $aRow);
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        The method CalculateColors uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        // Use only blue/red scale
                        $step = round(255 / ($this->nbrIsobars - 1));
                        for ($ib = 0; $ib < $this->nbrIsobars; ++$ib) {
                            $this->isobarColors[$ib] = [$ib * $step, 50, 255 - $ib * $step];
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

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

        Avoid unused private fields such as '$vertEdges'.
        Open

            private $vertEdges    = [];
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        UnusedPrivateField

        Since: 0.2

        Detects when a private field is declared and/or assigned a value, but not used.

        Example

        class Something
        {
            private static $FOO = 2; // Unused
            private $i = 5; // Unused
            private $j = 6;
            public function addOne()
            {
                return $this->j++;
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield

        Avoid unused local variables such as '$n'.
        Open

                    $n    = $this->nbrIsobars;
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        UnusedLocalVariable

        Since: 0.2

        Detects when a local variable is declared and/or assigned, but not used.

        Example

        class Foo {
            public function doSomething()
            {
                $i = 5; // Unused
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

        Avoid unused private fields such as '$horizEdges'.
        Open

            private $horizEdges   = [];
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        UnusedPrivateField

        Since: 0.2

        Detects when a private field is declared and/or assigned a value, but not used.

        Example

        class Something
        {
            private static $FOO = 2; // Unused
            private $i = 5; // Unused
            private $j = 6;
            public function addOne()
            {
                return $this->j++;
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield

        Avoid unused private fields such as '$stack'.
        Open

            private $stack;
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        UnusedPrivateField

        Since: 0.2

        Detects when a private field is declared and/or assigned a value, but not used.

        Example

        class Something
        {
            private static $FOO = 2; // Unused
            private $i = 5; // Unused
            private $j = 6;
            public function addOne()
            {
                return $this->j++;
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield

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

                                $this->isobarCoord[$isobar][$ncoord++] = [
                                    $this->getCrossingCoord($neigh[$n3][0], $neigh[$n3][1], $neigh[$n3][2], $ib),
                                    $this->getCrossingCoord($neigh[$n4][0], $neigh[$n4][1], $neigh[$n4][2], $ib), ];
        Severity: Major
        Found in src/plot/Contour.php and 2 other locations - About 1 hr to fix
        src/plot/Contour.php on lines 367..369
        src/plot/Contour.php on lines 397..399

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

        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 3 locations. Consider refactoring.
        Open

                                $this->isobarCoord[$isobar][$ncoord++] = [
                                    $this->getCrossingCoord($neigh[$n1][0], $neigh[$n1][1], $neigh[$n1][2], $ib),
                                    $this->getCrossingCoord($neigh[$n2][0], $neigh[$n2][1], $neigh[$n2][2], $ib), ];
        Severity: Major
        Found in src/plot/Contour.php and 2 other locations - About 1 hr to fix
        src/plot/Contour.php on lines 397..399
        src/plot/Contour.php on lines 401..403

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

        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 3 locations. Consider refactoring.
        Open

                                $this->isobarCoord[$isobar][$ncoord++] = [
                                    $this->getCrossingCoord($neigh[$n1][0], $neigh[$n1][1], $neigh[$n1][2], $ib),
                                    $this->getCrossingCoord($neigh[$n2][0], $neigh[$n2][1], $neigh[$n2][2], $ib), ];
        Severity: Major
        Found in src/plot/Contour.php and 2 other locations - About 1 hr to fix
        src/plot/Contour.php on lines 367..369
        src/plot/Contour.php on lines 401..403

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

        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

        Avoid variables with short names like $ib. Configured minimum length is 3.
        Open

                $ib = $this->isobarValues[$aIsobar];
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $v. Configured minimum length is 3.
        Open

                                $v      = $this->dataPoints[$row][$col];
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $v1. Configured minimum length is 3.
        Open

                $v1 = $this->dataPoints[$aRow][$aCol];
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $ni. Configured minimum length is 3.
        Open

                $ni = safe_count($this->isobarValues);
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $v. Configured minimum length is 3.
        Open

                    $v    = 0;
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $ib. Configured minimum length is 3.
        Open

                    $ib = $this->isobarValues[$isobar];
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $v1. Configured minimum length is 3.
        Open

                $v1 = $this->dataPoints[$aRow][$aCol];
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $v2. Configured minimum length is 3.
        Open

                $v2 = $this->dataPoints[$aRow][$aCol + 1];
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $ib. Configured minimum length is 3.
        Open

                    $ib = $this->isobarValues[$k];
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $d. Configured minimum length is 3.
        Open

                    $d = abs($this->dataPoints[$aRow][$aCol] - $this->dataPoints[$aRow][$aCol + 1]);
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $n. Configured minimum length is 3.
        Open

                            $n = 0;
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $mi. Configured minimum length is 3.
        Open

                    if (($mi = min($this->dataPoints[$i])) < $min) {
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $n4. Configured minimum length is 3.
        Open

                                    $n4 = 3;
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $n2. Configured minimum length is 3.
        Open

                                $n2                                    = 1;
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $ma. Configured minimum length is 3.
        Open

                    if (($ma = max($this->dataPoints[$i])) > $max) {
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $v2. Configured minimum length is 3.
        Open

                $v2 = $this->dataPoints[$aRow + 1][$aCol];
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $n. Configured minimum length is 3.
        Open

                    $n    = $this->nbrIsobars;
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $n1. Configured minimum length is 3.
        Open

                                $n1                                    = 0;
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $n3. Configured minimum length is 3.
        Open

                                    $n3 = 2;
        Severity: Minor
        Found in src/plot/Contour.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Method name "Contour::CalculateColors" is not in camel caps format
        Open

            public function CalculateColors()
        Severity: Minor
        Found in src/plot/Contour.php by phpcodesniffer

        Method name "Contour::SetInvert" is not in camel caps format
        Open

            public function SetInvert($aFlg = true)
        Severity: Minor
        Found in src/plot/Contour.php by phpcodesniffer

        Method name "Contour::UseHighContrastColor" is not in camel caps format
        Open

            public function UseHighContrastColor($aFlg = true, $aBW = false)
        Severity: Minor
        Found in src/plot/Contour.php by phpcodesniffer

        Line exceeds 120 characters; contains 182 characters
        Open

                                $midval = ($this->dataPoints[$row][$col] + $this->dataPoints[$row][$col + 1] + $this->dataPoints[$row + 1][$col] + $this->dataPoints[$row + 1][$col + 1]) / 4;
        Severity: Minor
        Found in src/plot/Contour.php by phpcodesniffer

        There are no issues that match your filters.

        Category
        Status