File class-alnp-customizer.php
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Auto Load Next Post: Theme Customizer
*
* @since 1.5.0
Method alnp_get_customizer_controls
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function alnp_get_customizer_controls() {
/**
* Filter Customizer controls for Auto Load Next Post.
*
* @param array $controls Customizer controls to add.
Method alnp_get_customizer_settings
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function alnp_get_customizer_settings() {
$settings = $this->alnp_get_settings();
/**
* Filter Customizer settings for Auto Load Next Post.
Function alnp_init_customizer
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function alnp_init_customizer( $wp_customize ) {
/**
* Dont add settings to the customizer if the user does
* not have permission to make changes to the 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
Method alnp_init_customizer
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function alnp_init_customizer( $wp_customize ) {
/**
* Dont add settings to the customizer if the user does
* not have permission to make changes to the theme.
*/
Function alnp_remove_widgets_panel
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function alnp_remove_widgets_panel( $components ) {
if ( $this->alnp_is_customizer() ) {
foreach( $components as $key => $component ) {
if ( $component == 'widgets' ) {
unset( $components[ 'widgets' ] );
- 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 true;
Function is_page_alnp_ready
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function is_page_alnp_ready() {
if ( is_front_page() && is_home() ) {
return false;
} elseif ( is_front_page() ) {
return false;
- 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"