Showing 702 of 1,100 total issues
Avoid deeply nested control flow statements. Open
if (strlen($imgdata) <= $this->maxb) {
break;
}
Function GenerateThumbnail
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function GenerateThumbnail()
{
$this->setOutputFormat();
$this->phpThumbDebug('8a');
$this->ResolveSource();
- Read upRead up
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');
}
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++;
Avoid deeply nested control flow statements. Open
switch ($secondbyte) {
case 0:
// end of line
// no need for special processing, just ignore
break;
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) {
- Read upRead up
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++;
}
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++;
Method Frame
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function Frame(&$gdimg, $frame_width, $edge_width, $hexcolor_frame, $hexcolor1, $hexcolor2)
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);
}
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();
Avoid deeply nested control flow statements. Open
if ($imagetypes & IMG_WBMP) {
$gd_info['WBMP Support'] = true;
}
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 = [];
- Read upRead up
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,
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)
Avoid deeply nested control flow statements. Open
if ($imagetypes & IMG_PNG) {
$gd_info['PNG Support'] = true;
}
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)
Avoid deeply nested control flow statements. Open
if ($imagetypes & IMG_GIF) {
$gd_info['GIF Create Support'] = true;
}
Method DropShadow
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function DropShadow(&$gdimg, $distance, $width, $hexcolor, $angle, $alpha)
Avoid deeply nested control flow statements. Open
if ($imagetypes & IMG_JPG) {
$gd_info['JPG Support'] = true;
}