Function compare_values
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public static function compare_values( $value1, $value2, $operator ) {
if ( '===' === $operator ) {
return $value1 === $value2;
}
if ( '!==' === $operator ) {
- Read upRead up
- Create a ticketCreate a ticket
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_filesystem
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function init_filesystem() {
$credentials = [];
if ( ! defined( 'FS_METHOD' ) ) {
define( 'FS_METHOD', 'direct' );
- Read upRead up
- Create a ticketCreate a ticket
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 compare_values
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function compare_values( $value1, $value2, $operator ) {
if ( '===' === $operator ) {
return $value1 === $value2;
}
if ( '!==' === $operator ) {
- Create a ticketCreate a ticket
Method init_filesystem
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function init_filesystem() {
$credentials = [];
if ( ! defined( 'FS_METHOD' ) ) {
define( 'FS_METHOD', 'direct' );
- Create a ticketCreate a ticket
Function recurse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function recurse( $array, $array1 ) {
foreach ( $array1 as $key => $value ) {
// Create new key in $array, if it is empty or not an array.
if ( ! isset( $array[ $key ] ) || ( isset( $array[ $key ] ) && ! is_array( $array[ $key ] ) ) ) {
- Read upRead up
- Create a ticketCreate a ticket
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 in_array( $value1, $value2 ); // phpcs:ignore WordPress.PHP.StrictInArray
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $value2 > $value1;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return true;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return false;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return ( false !== strrpos( $value1, $value2 ) || false !== strpos( $value2, $value1 ) );
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $value2 <= $value1;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $value2 < $value1;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return in_array( $value2, $value1 ); // phpcs:ignore WordPress.PHP.StrictInArray
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return ! self::compare_values( $value1, $value2, $operator );
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $value1 == $value2; // phpcs:ignore WordPress.PHP.StrictComparisons
- Create a ticketCreate a ticket
Function array_replace_recursive
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function array_replace_recursive( $array, $array1 ) {
if ( function_exists( 'array_replace_recursive' ) ) {
return array_replace_recursive( $array, $array1 );
}
- Read upRead up
- Create a ticketCreate a ticket
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"