Showing 5,566 of 7,504 total issues
Function wp_update_term_count
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) {
static $_deferred = array();
if ( $do_deferred ) {
foreach ( (array) array_keys($_deferred) as $tax ) {
- 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 ($j = 0; $j < $size; $j++) {
if ($nextScale != 0) {
$deltaScale = $this->expGolombUe();
$nextScale = ($lastScale + $deltaScale + 256) % 256;
}
Avoid deeply nested control flow statements. Open
if ($framedata{$i} != "\x00") {
$thisfile_id3v2['padding']['valid'] = false;
$thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i;
$info['warning'][] = 'Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)';
break;
Avoid deeply nested control flow statements. Open
if ((strtoupper($filesize) == '<DIR>') && (strtolower($filename) == strtolower($value))) {
$value = $shortname;
}
Avoid deeply nested control flow statements. Open
if ($MPEGaudioHeaderValidCache[$next4]) {
fseek($this->getid3->fp, -4, SEEK_CUR);
getid3_lib::safe_inc($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]);
getid3_lib::safe_inc($Distribution['layer'][$LongMPEGlayerLookup[$head4]]);
Avoid deeply nested control flow statements. Open
if ($track_info['dataformat'] == 'mp3' && preg_match('/^Probable truncated file: expecting \d+ bytes of audio data, only found \d+ \(short by \d+ bytes\)$/', $newerror)) {
// LAME/Xing header is probably set, but audio data is chunked into Matroska file and near-impossible to verify if audio stream is complete, so ignore useless warning
continue;
}
Avoid deeply nested control flow statements. Open
while ($this->getEBMLelement($subelement, $element_data['end'])) {
switch ($subelement['id']) {
case EBML_ID_ATTACHEDFILE:
$attachedfile_entry = array();
Function EBML2Int
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function EBML2Int($EBMLstring) {
// http://matroska.org/specs/
// Element ID coded with an UTF-8 like system:
// 1xxx xxxx - Class A IDs (2^7 -2 possible values) (base 0x8X)
- 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 ($info['mime_type'] == 'video/x-ms-asf') {
$info['mime_type'] = 'video/x-ms-wmv';
}
Avoid deeply nested control flow statements. Open
switch ($thisfile_riff_audio['codec_fourcc']) {
// http://developer.apple.com/qa/snd/snd07.html
case 'sowt':
$thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Little-Endian PCM';
$thisfile_audio['lossless'] = true;
Avoid deeply nested control flow statements. Open
if ($framedata{$i} != "\x00") {
$thisfile_id3v2['padding']['valid'] = false;
$thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i;
$info['warning'][] = 'Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)';
break;
Avoid deeply nested control flow statements. Open
if ($bitratevalue != 'free') {
$bittotal += ($bitratevalue * $bitratecount);
}
Function ParseID3v2GenreString
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function ParseID3v2GenreString($genrestring) {
// Parse genres into arrays of genreName and genreID
// ID3v2.2.x, ID3v2.3.x: '(21)' or '(4)Eurodisco' or '(51)(39)' or '(55)((I think...)'
// ID3v2.4.x: '21' $00 'Eurodisco' $00
$clean_genres = array();
- 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 ($this->getEBMLelement($track_entry, $element_data['end'])) {
switch ($track_entry['id']) {
case EBML_ID_TRACKENTRY: //subelements: Describes a track with all elements.
Avoid deeply nested control flow statements. Open
while ($this->getEBMLelement($subelement, $element_data['end'], true)) {
switch ($subelement['id']) {
case EBML_ID_TIMECODESCALE:
$info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']);
Avoid deeply nested control flow statements. Open
if ($pct_data_scanned > 0) {
$info['warning'][] = 'too many MPEG audio frames to scan, only scanned '.$frames_scanned.' frames in '.$max_scan_segments.' segments ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.';
foreach ($info['mpeg']['audio'] as $key1 => $value1) {
if (!preg_match('#_distribution$#i', $key1)) {
continue;
Function iconv_fallback
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function iconv_fallback($in_charset, $out_charset, $string) {
if ($in_charset == $out_charset) {
return $string;
}
- 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 ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
{
if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
{
$img->setAttribute('src', $this->image_handler . $image_url);
Function crop
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) {
if ( $src_abs ) {
$src_w -= $src_x;
$src_h -= $src_y;
}
- 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
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false)