HuasoFoundries/jpgraph

View on GitHub
src/util/RGB.php

Summary

Maintainability
F
1 mo
Test Coverage

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

    public function __construct($aImg = null)
    {
        $this->img = $aImg;

        // Conversion array between color names and RGB
Severity: Major
Found in src/util/RGB.php - About 2 days to fix

    File RGB.php has 551 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * JPGraph v4.0.3
     */
    Severity: Major
    Found in src/util/RGB.php - About 1 day to fix

      Function Color has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function Color($aColor)
          {
              if (is_string($aColor)) {
                  $matches = [];
                  // this regex will parse a color string and fill the $matches array as such:
      Severity: Minor
      Found in src/util/RGB.php - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method Color has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function Color($aColor)
          {
              if (is_string($aColor)) {
                  $matches = [];
                  // this regex will parse a color string and fill the $matches array as such:
      Severity: Minor
      Found in src/util/RGB.php - About 1 hr to fix

        Function tryHexConversion has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function tryHexConversion($aColor)
            {
                if (is_array($aColor)) {
                    if (safe_count($aColor) == 3) {
                        if (is_numeric($aColor[0]) && is_numeric($aColor[1]) && is_numeric($aColor[2])) {
        Severity: Minor
        Found in src/util/RGB.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 (($aColor[0] >= 0 && $aColor[0] <= 255) &&
                                ($aColor[1] >= 0 && $aColor[1] <= 255) &&
                                ($aColor[2] >= 0 && $aColor[2] <= 255)) {
                                return sprintf('#%02x%02x%02x', $aColor[0], $aColor[1], $aColor[2]);
                            }
        Severity: Major
        Found in src/util/RGB.php - About 40 mins to fix

          Avoid too many return statements within this method.
          Open

                  return [$sat, round($sat - $sat * ($aVal - 0.75) / $a), 0];
          Severity: Major
          Found in src/util/RGB.php - About 30 mins to fix

            The method Color() has an NPath complexity of 1283. The configured NPath complexity threshold is 200.
            Open

                public function Color($aColor)
                {
                    if (is_string($aColor)) {
                        $matches = [];
                        // this regex will parse a color string and fill the $matches array as such:
            Severity: Minor
            Found in src/util/RGB.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 __construct() has 448 lines of code. Current threshold is set to 100. Avoid really long methods.
            Open

                public function __construct($aImg = null)
                {
                    $this->img = $aImg;
            
                    // Conversion array between color names and RGB
            Severity: Minor
            Found in src/util/RGB.php by phpmd

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

                public function Color($aColor)
                {
                    if (is_string($aColor)) {
                        $matches = [];
                        // this regex will parse a color string and fill the $matches array as such:
            Severity: Minor
            Found in src/util/RGB.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

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

                public static function tryHexConversion($aColor)
                {
                    if (is_array($aColor)) {
                        if (safe_count($aColor) == 3) {
                            if (is_numeric($aColor[0]) && is_numeric($aColor[1]) && is_numeric($aColor[2])) {
            Severity: Minor
            Found in src/util/RGB.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 static access to class 'Amenadiel\JpGraph\Util\JpGraphError' in method 'Color'.
            Open

                                JpGraphError::RaiseL(25078, $aColor); //(" Unknown color: $aColor");
            Severity: Minor
            Found in src/util/RGB.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 'Color'.
            Open

                            JpGraphError::RaiseL(25077); //('Adjustment factor for color must be > 0');
            Severity: Minor
            Found in src/util/RGB.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 'Color'.
            Open

                        JpGraphError::RaiseL(25079, $aColor, safe_count($aColor)); //(" Unknown color specification: $aColor , size=". safe_count($aColor));
            Severity: Minor
            Found in src/util/RGB.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 'Allocate'.
            Open

                        JpGraphError::RaiseL(25080); //('Alpha parameter for color must be between 0.0 and 1.0');
            Severity: Minor
            Found in src/util/RGB.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 Color uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            if (!isset($this->rgb_table[$matches[5]])) {
                                JpGraphError::RaiseL(25078, $aColor); //(" Unknown color: $aColor");
                            }
                            $r = $this->rgb_table[$matches[5]][0];
            Severity: Minor
            Found in src/util/RGB.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 'Color'.
            Open

                            JpGraphError::RaiseL(25078, $aColor); //(" Unknown color: $aColor");
            Severity: Minor
            Found in src/util/RGB.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 Color uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        JpGraphError::RaiseL(25079, $aColor, safe_count($aColor)); //(" Unknown color specification: $aColor , size=". safe_count($aColor));
                    }
            Severity: Minor
            Found in src/util/RGB.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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                public function __construct($aImg = null)
                {
                    $this->img = $aImg;
            
                    // Conversion array between color names and RGB
            Severity: Major
            Found in src/util/RGB.php and 1 other location - About 1 mo to fix
            src/image/RGB.php on lines 30..477

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

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

                        if (empty($matches[5])) {
                            $r = strlen($matches[2]) == 1 ? $matches[2] . $matches[2] : $matches[2];
                            $g = strlen($matches[3]) == 1 ? $matches[3] . $matches[3] : $matches[3];
                            $b = strlen($matches[4]) == 1 ? $matches[4] . $matches[4] : $matches[4];
                            $r = hexdec($r);
            Severity: Major
            Found in src/util/RGB.php and 1 other location - About 1 day to fix
            src/image/RGB.php on lines 509..523

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

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

                public static function GetSpectrum($aVal, $aDynamicRange = 1.0)
                {
                    if ($aVal < 0 || $aVal > 1.0001) {
                        return [0, 0, 0]; // Invalid case - just return black
                    }
            Severity: Major
            Found in src/util/RGB.php and 1 other location - About 7 hrs to fix
            src/image/RGB.php on lines 618..637

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

            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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                public static function tryHexConversion($aColor)
                {
                    if (is_array($aColor)) {
                        if (safe_count($aColor) == 3) {
                            if (is_numeric($aColor[0]) && is_numeric($aColor[1]) && is_numeric($aColor[2])) {
            Severity: Major
            Found in src/util/RGB.php and 1 other location - About 5 hrs to fix
            src/image/RGB.php on lines 594..609

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

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

                public function Allocate($aColor, $aAlpha = 0.0)
                {
                    list($r, $g, $b, $a) = $this->color($aColor);
                    // If alpha is specified in the color string then this
                    // takes precedence over the second argument
            Severity: Major
            Found in src/util/RGB.php and 1 other location - About 1 hr to fix
            src/image/RGB.php on lines 574..587

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

            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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                        if ($adj > 1) {
                            $m = ($adj - 1.0) * (255 - min(255, min($r, min($g, $b))));
            
                            return [min(255, $r + $m), min(255, $g + $m), min(255, $b + $m), $alpha];
                        }
            Severity: Major
            Found in src/util/RGB.php and 1 other location - About 1 hr to fix
            src/image/RGB.php on lines 541..545

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

            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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                        if ($adj < 1) {
                            $m = ($adj - 1.0) * max(255, max($r, max($g, $b)));
            
                            return [max(0, $r + $m), max(0, $g + $m), max(0, $b + $m), $alpha];
                        }
            Severity: Major
            Found in src/util/RGB.php and 1 other location - About 1 hr to fix
            src/image/RGB.php on lines 546..550

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

            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 $m. Configured minimum length is 3.
            Open

                            $m = ($adj - 1.0) * (255 - min(255, min($r, min($g, $b))));
            Severity: Minor
            Found in src/util/RGB.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 $b. Configured minimum length is 3.
            Open

                    list($r, $g, $b, $a) = $this->color($aColor);
            Severity: Minor
            Found in src/util/RGB.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 $a. Configured minimum length is 3.
            Open

                    list($r, $g, $b, $a) = $this->color($aColor);
            Severity: Minor
            Found in src/util/RGB.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 $r. Configured minimum length is 3.
            Open

                            $r = strlen($matches[2]) == 1 ? $matches[2] . $matches[2] : $matches[2];
            Severity: Minor
            Found in src/util/RGB.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 $g. Configured minimum length is 3.
            Open

                            $g = strlen($matches[3]) == 1 ? $matches[3] . $matches[3] : $matches[3];
            Severity: Minor
            Found in src/util/RGB.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 $c2. Configured minimum length is 3.
            Open

                    $c2 = $this->Color($aCol2);
            Severity: Minor
            Found in src/util/RGB.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 $r. Configured minimum length is 3.
            Open

                    list($r, $g, $b, $a) = $this->color($aColor);
            Severity: Minor
            Found in src/util/RGB.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 $a. Configured minimum length is 3.
            Open

                    $a   = 0.25;
            Severity: Minor
            Found in src/util/RGB.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 $g. Configured minimum length is 3.
            Open

                    list($r, $g, $b, $a) = $this->color($aColor);
            Severity: Minor
            Found in src/util/RGB.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 $b. Configured minimum length is 3.
            Open

                            $b = strlen($matches[4]) == 1 ? $matches[4] . $matches[4] : $matches[4];
            Severity: Minor
            Found in src/util/RGB.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 $c1. Configured minimum length is 3.
            Open

                    $c1 = $this->Color($aCol1);
            Severity: Minor
            Found in src/util/RGB.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 "RGB::Allocate" is not in camel caps format
            Open

                public function Allocate($aColor, $aAlpha = 0.0)
            Severity: Minor
            Found in src/util/RGB.php by phpcodesniffer

            Method name "RGB::Color" is not in camel caps format
            Open

                public function Color($aColor)
            Severity: Minor
            Found in src/util/RGB.php by phpcodesniffer

            Method name "RGB::Equal" is not in camel caps format
            Open

                public function Equal($aCol1, $aCol2)
            Severity: Minor
            Found in src/util/RGB.php by phpcodesniffer

            Method name "RGB::GetSpectrum" is not in camel caps format
            Open

                public static function GetSpectrum($aVal, $aDynamicRange = 1.0)
            Severity: Minor
            Found in src/util/RGB.php by phpcodesniffer

            Line exceeds 120 characters; contains 144 characters
            Open

                        JpGraphError::RaiseL(25079, $aColor, safe_count($aColor)); //(" Unknown color specification: $aColor , size=". safe_count($aColor));
            Severity: Minor
            Found in src/util/RGB.php by phpcodesniffer

            Line exceeds 120 characters; contains 122 characters
            Open

                        // 1: a hex string preceded by a hash, can be 3 characters (#fff) or 6 (#ffffff) (4 or 5 also accepted but...)
            Severity: Minor
            Found in src/util/RGB.php by phpcodesniffer

            There are no issues that match your filters.

            Category
            Status