Showing 160 of 160 total issues
Function parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function parse( $val, $formatted = false ) {
if ( $formatted ) {
if ( ! is_array( $formatted ) ) {
$formatted = 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
Method display_item
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function display_item( $value, $label, $single_type, $id, $name, $current = '', $echo = true ) {
Method display_item
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function display_item( $value, $label, $single_type, $id, $name, $current = '', $echo = true ) {
Function is_rest_zero
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function is_rest_zero( $divident, $divisor ) {
$divident = abs( $divident );
$divisor = abs( $divisor );
if ( is_int( $divident ) && is_int( $divisor ) ) {
- 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 ( $parent === null ) {
$found = false;
break;
}
Function mod
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function mod( $divident, $divisor ) {
if ( is_int( $divident ) && is_int( $divisor ) ) {
// prevent division by zero
if ( 0 === $divisor ) {
return 0;
- 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 parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function parse( $val, $formatted = false ) {
if ( ! $val ) {
return '';
}
- 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
Consider simplifying this complex logical expression. Open
if ( ( ! isset( $a->$sort_by ) || null === $a->$sort_by ) && ( ! isset( $b->$sort_by ) || null === $b->$sort_by ) ) {
return 0;
} elseif ( ! isset( $a->$sort_by ) || null === $a->$sort_by ) {
return 1;
} elseif ( ! isset( $b->$sort_by ) || null === $b->$sort_by ) {
Method format_unit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function format_unit( $value, $units, $base, $base_unit = '', $decimals = 2 ) {
Function check_for_admin_page_func
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function check_for_admin_page_func( $slug ) {
if ( function_exists( 'add_' . $slug . '_page' ) ) {
switch ( $slug ) {
case 'dashboard':
return 'index.php';
- 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_children
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function get_children( $class = '' ) {
$children = array();
if ( $class && '*' !== $class ) {
if ( isset( $this->children[ $class ] ) ) {
- 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 add_menu_page
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function add_menu_page( $menu_item ) {
$status = false;
if ( is_callable( array( $menu_item, 'add_to_menu' ) ) ) {
$status = $menu_item->add_to_menu( array(
'mode' => 'menu',
- 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 display
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function display( $val, $echo = true ) {
$args = array(
'id' => $this->args['id'],
'class' => $this->args['class'],
);
- 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 parse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function parse( $val, $formatted = false ) {
if ( ! $val ) {
return '';
}
- 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 __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $type, $args ) {
$args = wp_parse_args( $args, array(
'options' => array(),
) );
parent::__construct( $type, $args );
- 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;
Avoid too many return
statements within this method. Open
return wp_mime_type_icon( $id );
Avoid too many return
statements within this method. Open
return '';
Avoid too many return
statements within this method. Open
return $id;
Avoid too many return
statements within this method. Open
return $this->get_attachment_path( $id, 'path', substr( $field, 0, -5 ) );