Showing 26,336 of 26,336 total issues
Avoid deeply nested control flow statements. Open
switch ($secondbyte) {
case 0:
// end of line
// no need for special processing, just ignore
break;
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
while (($pixeldataoffset % 4) != 0) {
// lines are padded to nearest DWORD
$pixeldataoffset++;
}
Avoid deeply nested control flow statements. Open
for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
$thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData{$pixeldataoffset + 3}) << 24)
| (ord($BMPpixelData{$pixeldataoffset + 2}) << 16)
| (ord($BMPpixelData{$pixeldataoffset + 1}) << 8)
| ord($BMPpixelData{$pixeldataoffset});
Avoid deeply nested control flow statements. Open
for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
$pixelvalue = $this->LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset, $thisfile_bmp_header_raw['bits_per_pixel'] / 8));
$pixeldataoffset += $thisfile_bmp_header_raw['bits_per_pixel'] / 8;
$red = (int)round(((($pixelvalue & $thisfile_bmp_header_raw['red_mask']) >> $redshift) / ($thisfile_bmp_header_raw['red_mask']
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
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 ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) {
$paletteindexbyte = ord($BMPpixelData{$pixeldataoffset++});
for ($i = 1; $i >= 0; $i--) {
$paletteindex = ($paletteindexbyte & (0x0F << (4 * $i))) >> (4 * $i);
$thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
Avoid deeply nested control flow statements. Open
for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
$paletteindex = ord($BMPpixelData{$pixeldataoffset++});
$thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
}
Avoid deeply nested control flow statements. Open
switch ($secondbyte) {
case 0:
// end of line
// no need for special processing, just ignore
break;
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
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++;
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
if (strlen($imgdata) <= $this->maxb) {
imagetruecolortopalette($this->gdimg_output, true, pow(2, $i));
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
while (($pixeldataoffset % 4) != 0) {
// lines are padded to nearest DWORD
$pixeldataoffset++;
}
Function file_exists_ignoreopenbasedir
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function file_exists_ignoreopenbasedir($filename, $cached = true)
{
static $open_basedirs = null;
static $file_exists_cache = array();
if (!$cached || !isset($file_exists_cache[$filename])) {
- 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
Function ImageMagickWhichConvert
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function ImageMagickWhichConvert()
{
static $WhichConvert = null;
if (is_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
if (preg_match('# \\-crop "([0-9]+)x([0-9]+)\\+0\\+0" #', $commandline, $matches)) {
$commandline = str_replace(' -crop "' . $matches[1] . 'x' . $matches[2] . '+0+0" ',
' -crop ' . phpthumb_functions::escapeshellarg_replacement(($matches[1] - (2 * $width))
. 'x'
. ($matches[2] - (2 * $width))