Function get_sql_for_subquery
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected function get_sql_for_subquery( $query ) {
global $wpdb;
// The sub-parts of a $where part
$where_parts = 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
Function build_time_query
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function build_time_query( $column, $compare, $hour = null, $minute = null, $second = null ) {
global $wpdb;
// Have to have at least one
if ( ! isset( $hour ) && ! isset( $minute ) && ! isset( $second ) )
- 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( $hour ) && ! isset( $minute ) && ! isset( $second ) && false !== ( $value = $this->build_value( $compare, $hour ) ) ) {
return "HOUR( $column ) $compare $value";
} elseif ( ! isset( $hour ) && isset( $minute ) && ! isset( $second ) && false !== ( $value = $this->build_value( $compare, $minute ) ) ) {
return "MINUTE( $column ) $compare $value";
} elseif ( ! isset( $hour ) && ! isset( $minute ) && isset( $second ) && false !== ( $value = $this->build_value( $compare, $second ) ) ) {
Method get_sql_for_subquery
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_sql_for_subquery( $query ) {
global $wpdb;
// The sub-parts of a $where part
$where_parts = array();
Method build_time_query
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build_time_query( $column, $compare, $hour = null, $minute = null, $second = null ) {
global $wpdb;
// Have to have at least one
if ( ! isset( $hour ) && ! isset( $minute ) && ! isset( $second ) )
Function __construct
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function __construct( $date_query, $default_column = 'post_date' ) {
if ( empty( $date_query ) || ! is_array( $date_query ) )
return;
if ( isset( $date_query['relation'] ) && strtoupper( $date_query['relation'] ) == 'OR' )
- 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 build_time_query
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function build_time_query( $column, $compare, $hour = null, $minute = null, $second = null ) {
Function build_mysql_datetime
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function build_mysql_datetime( $datetime, $default_to_max = false ) {
$now = current_time( 'timestamp' );
if ( ! is_array( $datetime ) ) {
// @todo Timezone issues here possibly
- 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 "SECOND( $column ) $compare $value";
Avoid too many return
statements within this method. Open
return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time );
Avoid too many return
statements within this method. Open
return false;