mambax7/pedigree

View on GitHub
class/ImageColor.php

Summary

Maintainability
D
2 days
Test Coverage

Method namedColor2RGB has 150 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function namedColor2RGB($color)
    {
        static $colornames;

        if (!isset($colornames)) {
Severity: Major
Found in class/ImageColor.php - About 6 hrs to fix

    File ImageColor.php has 380 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace XoopsModules\Pedigree;
    
    /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
    Severity: Minor
    Found in class/ImageColor.php - About 5 hrs to fix

      Function getRange has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getRange($degrees = 2)
          {
              if (0 == $degrees) {
                  $degrees = 1;
              }
      Severity: Minor
      Found in class/ImageColor.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 changeLightness has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public function changeLightness($degree = 10)
          {
              $color1 = &$this->color1;
              $color2 = &$this->color2;
      
      
      Severity: Minor
      Found in class/ImageColor.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

      Method hsv2hex has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function hsv2hex($h, $s, $v)
          {
              $s /= 256.0;
              $v /= 256.0;
              if (0.0 == $s) {
      Severity: Minor
      Found in class/ImageColor.php - About 1 hr to fix

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

            public function getRange($degrees = 2)
            {
                if (0 == $degrees) {
                    $degrees = 1;
                }
        Severity: Minor
        Found in class/ImageColor.php - About 1 hr to fix

          Function hsv2hex has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function hsv2hex($h, $s, $v)
              {
                  $s /= 256.0;
                  $v /= 256.0;
                  if (0.0 == $s) {
          Severity: Minor
          Found in class/ImageColor.php - About 45 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

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

          function _makeWebSafe(&$color)
          {
              if ($color < 0x1a) {
                  $color = 0x00;
              } elseif ($color < 0x4d) {
          Severity: Minor
          Found in class/ImageColor.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

          There are no issues that match your filters.

          Category
          Status