File presets.php
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Infinite Scroll Presets Interface
*
* Stores theme-specific presets for CSS Selectors to aid with setup. Pulls community presets from CSV
Infinite_Scroll_Presets
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Infinite_Scroll_Presets {
private $parent;
// public $preset_url = 'http://plugins.svn.wordpress.org/infinite-scroll/branches/PresetDB/presets.csv';
public $preset_url = 'https://raw.github.com/benbalter/Infinite-Scroll/presetDB/presets.csv';
Method prepare_items
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function prepare_items() {
global $infinite_scroll;
$per_page = 25;
Function parse_csv
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function parse_csv( $data ) {
if ( is_string( $data ) )
$data = explode( "\n", $data );
- 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 get_name
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function get_name( $stylesheet ) {
//3.4+
if ( function_exists( 'wp_get_theme' ) ) {
- 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 get_preset
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function get_preset( $theme = null ) {
if ( $theme == null )
$theme = get_stylesheet();
- 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 get_preset
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_preset( $theme = null ) {
if ( $theme == null )
$theme = get_stylesheet();
Function get_stylesheet
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function get_stylesheet( $name ) {
//pre 3.4
if ( !function_exists( 'wp_get_themes' ) ) {
- 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 prepare_items
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function prepare_items() {
global $infinite_scroll;
$per_page = 25;
- 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 export
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function export( $all = false ) {
$presets = array();
//if the current theme is not a known preset or they want all
- 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 too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $preset;