Function fetch_rss
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
function fetch_rss ($url) {
// initialize constants
init();
if ( !isset($url) ) {
- 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 fetch_rss
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetch_rss ($url) {
// initialize constants
init();
if ( !isset($url) ) {
Function _response_to_rss
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function _response_to_rss ($resp) {
$rss = new MagpieRSS( $resp->results, MAGPIE_OUTPUT_ENCODING, MAGPIE_INPUT_ENCODING, MAGPIE_DETECT_ENCODING );
// if RSS parsed successfully
if ( $rss and !$rss->ERROR) {
- 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 init
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function init () {
if ( defined('MAGPIE_INITALIZED') ) {
return;
}
else {
- 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 init
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function init () {
if ( defined('MAGPIE_INITALIZED') ) {
return;
}
else {
Method _response_to_rss
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _response_to_rss ($resp) {
$rss = new MagpieRSS( $resp->results, MAGPIE_OUTPUT_ENCODING, MAGPIE_INPUT_ENCODING, MAGPIE_DETECT_ENCODING );
// if RSS parsed successfully
if ( $rss and !$rss->ERROR) {
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $rss;
Avoid too many return
statements within this method. Open
return $rss;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $rss;