mambax7/pedigree

View on GitHub
phpthumb/phpthumb.filters.php

Summary

Maintainability
F
2 wks
Test Coverage

File phpthumb.filters.php has 1242 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
//////////////////////////////////////////////////////////////
//   phpThumb() by James Heinrich <info@silisoftware.com>   //
//        available at http://phpthumb.sourceforge.net      //
//         and/or https://github.com/JamesHeinrich/phpThumb //
Severity: Major
Found in phpthumb/phpthumb.filters.php - About 3 days to fix

    Function WatermarkText has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
    Open

        public function WatermarkText(&$gdimg, $text, $size, $alignment, $hex_color = '000000', $ttffont = '', $opacity = 100, $margin = 5, $angle = 0, $bg_color = false, $bg_opacity = 0, $fillextend = '', $lineheight = 1.0)
        {
            // text watermark requested
            if (!$text) {
                return false;
    Severity: Minor
    Found in phpthumb/phpthumb.filters.php - About 1 day 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 WatermarkText has 247 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function WatermarkText(&$gdimg, $text, $size, $alignment, $hex_color = '000000', $ttffont = '', $opacity = 100, $margin = 5, $angle = 0, $bg_color = false, $bg_opacity = 0, $fillextend = '', $lineheight = 1.0)
        {
            // text watermark requested
            if (!$text) {
                return false;
    Severity: Major
    Found in phpthumb/phpthumb.filters.php - About 1 day to fix

      Function DropShadow has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

          public function DropShadow(&$gdimg, $distance, $width, $hexcolor, $angle, $alpha)
          {
              if (phpthumb_functions::gd_version() < 2) {
                  return false;
              }
      Severity: Minor
      Found in phpthumb/phpthumb.filters.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

      Function ImprovedImageRotate has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function ImprovedImageRotate(&$gdimg_source, $rotate_angle = 0, $config_background_hexcolor = 'FFFFFF', $bg = null, &$phpThumbObject)
          {
              while ($rotate_angle < 0) {
                  $rotate_angle += 360;
              }
      Severity: Minor
      Found in phpthumb/phpthumb.filters.php - About 5 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

      phpthumb_filters has 37 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class phpthumb_filters
      {
          /**
           * @var phpthumb
           */
      Severity: Minor
      Found in phpthumb/phpthumb.filters.php - About 4 hrs to fix

        Function WatermarkOverlay has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            public function WatermarkOverlay(&$gdimg_dest, &$img_watermark, $alignment = '*', $opacity = 50, $margin_x = 5, $margin_y = null)
            {
                if ((is_resource($gdimg_dest) || (is_object($gdimg_dest) && $gdimg_dest instanceof \GdImage)) && (is_resource($img_watermark) || (is_object($img_watermark) && $img_watermark instanceof \GdImage))) {
                    $img_source_width          = imagesx($gdimg_dest);
                    $img_source_height         = imagesy($gdimg_dest);
        Severity: Minor
        Found in phpthumb/phpthumb.filters.php - About 4 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 WatermarkOverlay has 90 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function WatermarkOverlay(&$gdimg_dest, &$img_watermark, $alignment = '*', $opacity = 50, $margin_x = 5, $margin_y = null)
            {
                if ((is_resource($gdimg_dest) || (is_object($gdimg_dest) && $gdimg_dest instanceof \GdImage)) && (is_resource($img_watermark) || (is_object($img_watermark) && $img_watermark instanceof \GdImage))) {
                    $img_source_width          = imagesx($gdimg_dest);
                    $img_source_height         = imagesy($gdimg_dest);
        Severity: Major
        Found in phpthumb/phpthumb.filters.php - About 3 hrs to fix

          Function HistogramStretch has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              public function HistogramStretch(&$gdimg, $band = '*', $method = 0, $threshold = 0.1)
              {
                  // equivalent of "Auto Contrast" in Adobe Photoshop
                  // method 0 stretches according to RGB colors. Gives a more conservative stretch.
                  // method 1 band stretches according to grayscale which is color-biased (59% green, 30% red, 11% blue). May give a punchier / more aggressive stretch, possibly appearing over-saturated
          Severity: Minor
          Found in phpthumb/phpthumb.filters.php - About 3 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

          Function ApplyMask has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public function ApplyMask(&$gdimg_mask, &$gdimg_image)
              {
                  if (phpthumb_functions::gd_version() < 2) {
                      $this->DebugMessage('Skipping ApplyMask() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__);
                      return false;
          Severity: Minor
          Found in phpthumb/phpthumb.filters.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 DropShadow has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function DropShadow(&$gdimg, $distance, $width, $hexcolor, $angle, $alpha)
              {
                  if (phpthumb_functions::gd_version() < 2) {
                      return false;
                  }
          Severity: Major
          Found in phpthumb/phpthumb.filters.php - About 2 hrs to fix

            Method ImprovedImageRotate has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function ImprovedImageRotate(&$gdimg_source, $rotate_angle = 0, $config_background_hexcolor = 'FFFFFF', $bg = null, &$phpThumbObject)
                {
                    while ($rotate_angle < 0) {
                        $rotate_angle += 360;
                    }
            Severity: Major
            Found in phpthumb/phpthumb.filters.php - About 2 hrs to fix

              Method HistogramStretch has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function HistogramStretch(&$gdimg, $band = '*', $method = 0, $threshold = 0.1)
                  {
                      // equivalent of "Auto Contrast" in Adobe Photoshop
                      // method 0 stretches according to RGB colors. Gives a more conservative stretch.
                      // method 1 band stretches according to grayscale which is color-biased (59% green, 30% red, 11% blue). May give a punchier / more aggressive stretch, possibly appearing over-saturated
              Severity: Major
              Found in phpthumb/phpthumb.filters.php - About 2 hrs to fix

                Function Colorize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function Colorize(&$gdimg, $amount, $targetColor)
                    {
                        $amount      = (is_numeric($amount) ? $amount : 25);
                        $amountPct   = $amount / 100;
                        $targetColor = (phpthumb_functions::IsHexColor($targetColor) ? $targetColor : 'gray');
                Severity: Minor
                Found in phpthumb/phpthumb.filters.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

                Function ImageBorder has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function ImageBorder(&$gdimg, $border_width, $radius_x, $radius_y, $hexcolor_border)
                    {
                        $border_width = ($border_width ? $border_width : 1);
                        $radius_x     = ($radius_x ? $radius_x : 0);
                        $radius_y     = ($radius_y ? $radius_y : 0);
                Severity: Minor
                Found in phpthumb/phpthumb.filters.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

                Function HistogramOverlay has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function HistogramOverlay(&$gdimg, $bands = '*', $colors = '', $width = 0.25, $height = 0.25, $alignment = 'BR', $opacity = 50, $margin_x = 5, $margin_y = null)
                    {
                        $margin_y = (null === $margin_y ? $margin_x : $margin_y);
                
                        $Analysis = $this->HistogramAnalysis($gdimg, true);
                Severity: Minor
                Found in phpthumb/phpthumb.filters.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 ImageBorder has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function ImageBorder(&$gdimg, $border_width, $radius_x, $radius_y, $hexcolor_border)
                    {
                        $border_width = ($border_width ? $border_width : 1);
                        $radius_x     = ($radius_x ? $radius_x : 0);
                        $radius_y     = ($radius_y ? $radius_y : 0);
                Severity: Minor
                Found in phpthumb/phpthumb.filters.php - About 1 hr to fix

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

                      public function Sepia(&$gdimg, $amount, $targetColor)
                      {
                          $amount      = (is_numeric($amount) ? max(0, min(100, $amount)) : 50);
                          $amountPct   = $amount / 100;
                          $targetColor = (phpthumb_functions::IsHexColor($targetColor) ? $targetColor : 'A28065');
                  Severity: Minor
                  Found in phpthumb/phpthumb.filters.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 HistogramOverlay has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function HistogramOverlay(&$gdimg, $bands = '*', $colors = '', $width = 0.25, $height = 0.25, $alignment = 'BR', $opacity = 50, $margin_x = 5, $margin_y = null)
                      {
                          $margin_y = (null === $margin_y ? $margin_x : $margin_y);
                  
                          $Analysis = $this->HistogramAnalysis($gdimg, true);
                  Severity: Minor
                  Found in phpthumb/phpthumb.filters.php - About 1 hr to fix

                    Method WatermarkText has 13 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function WatermarkText(&$gdimg, $text, $size, $alignment, $hex_color = '000000', $ttffont = '', $opacity = 100, $margin = 5, $angle = 0, $bg_color = false, $bg_opacity = 0, $fillextend = '', $lineheight = 1.0)
                    Severity: Major
                    Found in phpthumb/phpthumb.filters.php - About 1 hr to fix

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

                          public function Contrast(&$gdimg, $amount = 0)
                          {
                              if ($amount == 0) {
                                  return true;
                              }
                      Severity: Minor
                      Found in phpthumb/phpthumb.filters.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 Flip has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function Flip(&$gdimg, $x = false, $y = false)
                          {
                              if (!$x && !$y) {
                                  return false;
                              }
                      Severity: Minor
                      Found in phpthumb/phpthumb.filters.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 Colorize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function Colorize(&$gdimg, $amount, $targetColor)
                          {
                              $amount      = (is_numeric($amount) ? $amount : 25);
                              $amountPct   = $amount / 100;
                              $targetColor = (phpthumb_functions::IsHexColor($targetColor) ? $targetColor : 'gray');
                      Severity: Minor
                      Found in phpthumb/phpthumb.filters.php - About 1 hr to fix

                        Method Sepia has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function Sepia(&$gdimg, $amount, $targetColor)
                            {
                                $amount      = (is_numeric($amount) ? max(0, min(100, $amount)) : 50);
                                $amountPct   = $amount / 100;
                                $targetColor = (phpthumb_functions::IsHexColor($targetColor) ? $targetColor : 'A28065');
                        Severity: Minor
                        Found in phpthumb/phpthumb.filters.php - About 1 hr to fix

                          Method ApplyMask has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function ApplyMask(&$gdimg_mask, &$gdimg_image)
                              {
                                  if (phpthumb_functions::gd_version() < 2) {
                                      $this->DebugMessage('Skipping ApplyMask() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__);
                                      return false;
                          Severity: Minor
                          Found in phpthumb/phpthumb.filters.php - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                    if ((is_resource($gdimg_dest) || (is_object($gdimg_dest) && $gdimg_dest instanceof \GdImage)) && (is_resource($img_watermark) || (is_object($img_watermark) && $img_watermark instanceof \GdImage))) {
                                        $img_source_width          = imagesx($gdimg_dest);
                                        $img_source_height         = imagesy($gdimg_dest);
                                        $watermark_source_width    = imagesx($img_watermark);
                                        $watermark_source_height   = imagesy($img_watermark);
                            Severity: Critical
                            Found in phpthumb/phpthumb.filters.php - About 1 hr to fix

                              Method WhiteBalance has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function WhiteBalance(&$gdimg, $targetColor = '')
                                  {
                                      if (phpthumb_functions::IsHexColor($targetColor)) {
                                          $targetPixel = [
                                              'red'   => hexdec(substr($targetColor, 0, 2)),
                              Severity: Minor
                              Found in phpthumb/phpthumb.filters.php - About 1 hr to fix

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

                                    public function Brightness(&$gdimg, $amount = 0)
                                    {
                                        if ($amount == 0) {
                                            return true;
                                        }
                                Severity: Minor
                                Found in phpthumb/phpthumb.filters.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 Crop has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function Crop(&$gdimg, $left = 0, $right = 0, $top = 0, $bottom = 0)
                                    {
                                        if (!$left && !$right && !$top && !$bottom) {
                                            return true;
                                        }
                                Severity: Minor
                                Found in phpthumb/phpthumb.filters.php - About 1 hr to fix

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

                                      public function HistogramOverlay(&$gdimg, $bands = '*', $colors = '', $width = 0.25, $height = 0.25, $alignment = 'BR', $opacity = 50, $margin_x = 5, $margin_y = null)
                                  Severity: Major
                                  Found in phpthumb/phpthumb.filters.php - About 1 hr to fix

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

                                        public function Contrast(&$gdimg, $amount = 0)
                                        {
                                            if ($amount == 0) {
                                                return true;
                                            }
                                    Severity: Minor
                                    Found in phpthumb/phpthumb.filters.php - About 1 hr to fix

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

                                          public function Crop(&$gdimg, $left = 0, $right = 0, $top = 0, $bottom = 0)
                                          {
                                              if (!$left && !$right && !$top && !$bottom) {
                                                  return true;
                                              }
                                      Severity: Minor
                                      Found in phpthumb/phpthumb.filters.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

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

                                          public function HistogramAnalysis(&$gdimg, $calculateGray = false)
                                          {
                                              $ImageSX  = imagesx($gdimg);
                                              $ImageSY  = imagesy($gdimg);
                                              $Analysis = [];
                                      Severity: Minor
                                      Found in phpthumb/phpthumb.filters.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

                                      Method DropShadow has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          public function DropShadow(&$gdimg, $distance, $width, $hexcolor, $angle, $alpha)
                                      Severity: Minor
                                      Found in phpthumb/phpthumb.filters.php - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                                if (!isset($PixelMap[$x][$y]['alpha']) || ($PixelMap[$x][$y]['alpha'] > 0)) {
                                                                    if (isset($PixelMap[$x + $Offset['x']][$y + $Offset['y']]['alpha']) && ($PixelMap[$x + $Offset['x']][$y + $Offset['y']]['alpha'] < 127)) {
                                                                        $thisColor = phpthumb_functions::ImageHexColorAllocate($gdimg, $hexcolor, false, $PixelMap[$x + $Offset['x']][$y + $Offset['y']]['alpha']);
                                                                        imagesetpixel($gdimg_dropshadow_temp, $x, $y, $thisColor);
                                                                    }
                                        Severity: Major
                                        Found in phpthumb/phpthumb.filters.php - About 45 mins to fix

                                          Method Frame has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                              public function Frame(&$gdimg, $frame_width, $edge_width, $hexcolor_frame, $hexcolor1, $hexcolor2)
                                          Severity: Minor
                                          Found in phpthumb/phpthumb.filters.php - About 45 mins to fix

                                            Method WatermarkOverlay has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                                public function WatermarkOverlay(&$gdimg_dest, &$img_watermark, $alignment = '*', $opacity = 50, $margin_x = 5, $margin_y = null)
                                            Severity: Minor
                                            Found in phpthumb/phpthumb.filters.php - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                              for ($y = $watermark_margin_y; $y < ($img_source_height + $watermark_source_height); $y += ($watermark_source_height + $watermark_margin_y)) {
                                                                                  imagecopy(
                                                                                      $gdimg_tiledwatermark,
                                                                                      $img_watermark,
                                                                                      $x,
                                              Severity: Major
                                              Found in phpthumb/phpthumb.filters.php - About 45 mins to fix

                                                Method ImageBorder has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                    public function ImageBorder(&$gdimg, $border_width, $radius_x, $radius_y, $hexcolor_border)
                                                Severity: Minor
                                                Found in phpthumb/phpthumb.filters.php - About 35 mins to fix

                                                  Method ImprovedImageRotate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                  Open

                                                      public static function ImprovedImageRotate(&$gdimg_source, $rotate_angle = 0, $config_background_hexcolor = 'FFFFFF', $bg = null, &$phpThumbObject)
                                                  Severity: Minor
                                                  Found in phpthumb/phpthumb.filters.php - About 35 mins to fix

                                                    Method Crop has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                    Open

                                                        public function Crop(&$gdimg, $left = 0, $right = 0, $top = 0, $bottom = 0)
                                                    Severity: Minor
                                                    Found in phpthumb/phpthumb.filters.php - About 35 mins to fix

                                                      Function Threshold has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          public function Threshold(&$gdimg, $cutoff)
                                                          {
                                                              $width  = imagesx($gdimg);
                                                              $height = imagesy($gdimg);
                                                              $cutoff = min(255, max(0, ($cutoff ? $cutoff : 128)));
                                                      Severity: Minor
                                                      Found in phpthumb/phpthumb.filters.php - About 35 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 Negative has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          public function Negative(&$gdimg)
                                                          {
                                                              if (phpthumb_functions::version_compare_replacement(PHP_VERSION, '5.0.0', '>=') && phpthumb_functions::gd_is_bundled()) {
                                                                  if (imagefilter($gdimg, IMG_FILTER_NEGATE)) {
                                                                      return true;
                                                      Severity: Minor
                                                      Found in phpthumb/phpthumb.filters.php - About 35 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 SourceTransparentColorMask has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          public function SourceTransparentColorMask(&$gdimg, $hexcolor, $min_limit = 5, $max_limit = 10)
                                                          {
                                                              $width  = imagesx($gdimg);
                                                              $height = imagesy($gdimg);
                                                              if ($gdimg_mask = imagecreatetruecolor($width, $height)) {
                                                      Severity: Minor
                                                      Found in phpthumb/phpthumb.filters.php - About 25 mins to fix

                                                      Cognitive Complexity

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

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

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

                                                      Further reading

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

                                                          public function Ellipse($gdimg)
                                                          {
                                                              if (phpthumb_functions::gd_version() < 2) {
                                                                  return false;
                                                              }
                                                      Severity: Minor
                                                      Found in phpthumb/phpthumb.filters.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

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

                                                                      if (phpthumb_functions::IsHexColor($bg_color)) {
                                                                          $text_background_alpha = round(127 * ((100 - min(max(0, $bg_opacity), 100)) / 100));
                                                                          $text_color_background = phpthumb_functions::ImageHexColorAllocate($gdimg, $bg_color, false, $text_background_alpha);
                                                                      } else {
                                                                          $text_color_background = phpthumb_functions::ImageHexColorAllocate($gdimg, 'FFFFFF', false, 127);
                                                      Severity: Major
                                                      Found in phpthumb/phpthumb.filters.php and 1 other location - About 1 hr to fix
                                                      phpthumb/phpthumb.filters.php on lines 1288..1293

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

                                                      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 (phpthumb_functions::IsHexColor($bg_color)) {
                                                                          $text_background_alpha = round(127 * ((100 - min(max(0, $bg_opacity), 100)) / 100));
                                                                          $text_color_background = phpthumb_functions::ImageHexColorAllocate($img_watermark, $bg_color, false, $text_background_alpha);
                                                                      } else {
                                                                          $text_color_background = phpthumb_functions::ImageHexColorAllocate($img_watermark, 'FFFFFF', false, 127);
                                                      Severity: Major
                                                      Found in phpthumb/phpthumb.filters.php and 1 other location - About 1 hr to fix
                                                      phpthumb/phpthumb.filters.php on lines 1220..1225

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

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

                                                          public function EdgeDetect(&$gdimg)
                                                          {
                                                              if (phpthumb_functions::version_compare_replacement(PHP_VERSION, '5.0.0', '>=') && phpthumb_functions::gd_is_bundled()) {
                                                                  if (imagefilter($gdimg, IMG_FILTER_EDGEDETECT)) {
                                                                      return true;
                                                      Severity: Major
                                                      Found in phpthumb/phpthumb.filters.php and 3 other locations - About 55 mins to fix
                                                      phpthumb/phpthumb.filters.php on lines 140..152
                                                      phpthumb/phpthumb.filters.php on lines 436..448
                                                      phpthumb/phpthumb.filters.php on lines 836..848

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

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

                                                          public function Emboss(&$gdimg)
                                                          {
                                                              if (phpthumb_functions::version_compare_replacement(PHP_VERSION, '5.0.0', '>=') && phpthumb_functions::gd_is_bundled()) {
                                                                  if (imagefilter($gdimg, IMG_FILTER_EMBOSS)) {
                                                                      return true;
                                                      Severity: Major
                                                      Found in phpthumb/phpthumb.filters.php and 3 other locations - About 55 mins to fix
                                                      phpthumb/phpthumb.filters.php on lines 140..152
                                                      phpthumb/phpthumb.filters.php on lines 397..409
                                                      phpthumb/phpthumb.filters.php on lines 836..848

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

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

                                                          public function BlurSelective(&$gdimg)
                                                          {
                                                              if (phpthumb_functions::version_compare_replacement(PHP_VERSION, '5.0.0', '>=') && phpthumb_functions::gd_is_bundled()) {
                                                                  if (imagefilter($gdimg, IMG_FILTER_SELECTIVE_BLUR)) {
                                                                      return true;
                                                      Severity: Major
                                                      Found in phpthumb/phpthumb.filters.php and 3 other locations - About 55 mins to fix
                                                      phpthumb/phpthumb.filters.php on lines 397..409
                                                      phpthumb/phpthumb.filters.php on lines 436..448
                                                      phpthumb/phpthumb.filters.php on lines 836..848

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

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

                                                          public function MeanRemoval(&$gdimg)
                                                          {
                                                              if (phpthumb_functions::version_compare_replacement(PHP_VERSION, '5.0.0', '>=') && phpthumb_functions::gd_is_bundled()) {
                                                                  if (imagefilter($gdimg, IMG_FILTER_MEAN_REMOVAL)) {
                                                                      return true;
                                                      Severity: Major
                                                      Found in phpthumb/phpthumb.filters.php and 3 other locations - About 55 mins to fix
                                                      phpthumb/phpthumb.filters.php on lines 140..152
                                                      phpthumb/phpthumb.filters.php on lines 397..409
                                                      phpthumb/phpthumb.filters.php on lines 436..448

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

                                                      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

                                                      There are no issues that match your filters.

                                                      Category
                                                      Status