mambax7/pedigree

View on GitHub

Showing 702 of 1,100 total issues

Avoid deeply nested control flow statements.
Open

                            if (strlen($imgdata) <= $this->maxb) {
                                break;
                            }
Severity: Major
Found in phpthumb/phpthumb.class.php - About 45 mins to fix

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

        public function GenerateThumbnail()
        {
            $this->setOutputFormat();
            $this->phpThumbDebug('8a');
            $this->ResolveSource();
    Severity: Minor
    Found in phpthumb/phpthumb.class.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

    Avoid deeply nested control flow statements.
    Open

                                            if (!phpthumb_functions::IsHexColor($color)) {
                                                $color = ((!empty($this->bc) && phpthumb_functions::IsHexColor($this->bc)) ? $this->bc : '000000');
                                            }
    Severity: Major
    Found in phpthumb/phpthumb.class.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                          for ($i = 0; $i < $firstbyte; $i++) {
                                              $col                              = $pixelcounter % $thisfile_bmp_header_raw['width'];
                                              $row                              = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']);
                                              $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindexes[$i % 2]];
                                              $pixelcounter++;
      Severity: Major
      Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                            switch ($secondbyte) {
                                                case 0:
                                                    // end of line
                                                    // no need for special processing, just ignore
                                                    break;
        Severity: Major
        Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

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

              public function ImageMagickWhichConvert()
              {
                  static $WhichConvert = null;
                  if (null === $WhichConvert) {
                      if ($this->iswindows) {
          Severity: Minor
          Found in phpthumb/phpthumb.class.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

          Avoid deeply nested control flow statements.
          Open

                                          while (($pixeldataoffset % 4) != 0) {
                                              // lines are padded to nearest DWORD
                                              $pixeldataoffset++;
                                          }
          Severity: Major
          Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                                for ($i = 0; $i < $firstbyte; $i++) {
                                                    $col                              = $pixelcounter % $thisfile_bmp_header_raw['width'];
                                                    $row                              = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']);
                                                    $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$secondbyte];
                                                    $pixelcounter++;
            Severity: Major
            Found in phpthumb/phpthumb.bmp.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

                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

                  Avoid deeply nested control flow statements.
                  Open

                                      if ($tempfilename = phpthumb::phpThumb_tempnam()) {
                                          if ($fp_tempfile = @fopen($tempfilename, 'wb')) {
                                              fwrite($fp_tempfile, base64_decode('R0lGODlhAQABAIAAAH//AP///ywAAAAAAQABAAACAUQAOw==')); // very simple 1px GIF file base64-encoded as string
                                              fclose($fp_tempfile);
                                              $phpthumb_temp = new phpthumb();
                  Severity: Major
                  Found in phpthumb/phpthumb.functions.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if ($imagetypes & IMG_WBMP) {
                                            $gd_info['WBMP Support'] = true;
                                        }
                    Severity: Major
                    Found in phpthumb/phpthumb.functions.php - About 45 mins to fix

                      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

                      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 ScaleToFitInBox has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public static function ScaleToFitInBox($width, $height, $maxwidth = null, $maxheight = null, $allow_enlarge = true, $allow_reduce = true)
                        Severity: Minor
                        Found in phpthumb/phpthumb.functions.php - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if ($imagetypes & IMG_PNG) {
                                                  $gd_info['PNG Support'] = true;
                                              }
                          Severity: Major
                          Found in phpthumb/phpthumb.functions.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

                                                  if ($imagetypes & IMG_GIF) {
                                                      $gd_info['GIF Create Support'] = true;
                                                  }
                              Severity: Major
                              Found in phpthumb/phpthumb.functions.php - About 45 mins to fix

                                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 ($imagetypes & IMG_JPG) {
                                                          $gd_info['JPG Support'] = true;
                                                      }
                                  Severity: Major
                                  Found in phpthumb/phpthumb.functions.php - About 45 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language