Showing 150 of 187 total issues
Method maybe_filter_by_table_columns
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function maybe_filter_by_table_columns( $wp_query ) {
$table_columns = $this->component->table_columns;
$tax_query = array();
$meta_query = array();
Method register
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register() {
if ( ! $this->is_already_added() ) {
$_post_type_args = $this->args;
unset( $_post_type_args['title'] );
Method validate_labels
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function validate_labels( $args, $key, $mode ) {
if ( false === $args[ $key ] ) {
$args[ $key ] = array();
return $args;
}
Method get_defaults
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_defaults() {
$defaults = array(
'title' => '',
'singular_title' => '',
'title_gender' => 'n',
Method validate_args
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function validate_args( $args ) {
// handle admin table columns
if ( ! $args['show_ui'] || ! is_array( $args['table_columns'] ) ) {
$args['table_columns'] = array();
}
Function validate_titles
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function validate_titles( $args, $slug, $mode ) {
if ( empty( $args['title'] ) && isset( $args['label'] ) ) {
$args['title'] = $args['label'];
unset( $args['label'] );
}
- 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 handle_bulk_action
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function handle_bulk_action( $sendback, $bulk_action, $item_ids ) {
$bulk_actions = $this->component->bulk_actions;
$component_plural_name = $this->component->title;
$action_message = 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"
Further reading
Function add_taxonomy_hooks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function add_taxonomy_hooks() {
if ( 0 > version_compare( get_bloginfo( 'version' ), '4.5' ) ) {
add_action( 'load-edit-tags.php', array( $this, 'add_term_or_term_list_help' ) );
} else {
add_action( 'load-edit-tags.php', array( $this, 'add_term_list_help' ) );
- 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 render_table_column
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function render_table_column( $column_name, $term_id ) {
$table_columns = $this->component->table_columns;
if ( isset( $table_columns[ $column_name ] ) ) {
if ( isset( $table_columns[ $column_name ]['meta_key'] ) && ! empty( $table_columns[ $column_name ]['meta_key'] ) ) {
$field = $this->get_child_field( $table_columns[ $column_name ]['meta_key'] );
- 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_term_metaboxes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function add_term_metaboxes( $term_metaboxes, $taxonomy ) {
foreach ( $term_metaboxes as $term_metabox_slug => $term_metabox_args ) {
$term_metabox = $taxonomy->add( new TermMetabox( $term_metabox_slug, $term_metabox_args ) );
if ( is_wp_error( $term_metabox ) ) {
self::doing_it_wrong( __METHOD__, $term_metabox->get_error_message(), '0.6.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
Method run_row_action
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function run_row_action( $row_action, $item_id ) {
$row_actions = $this->component->row_actions;
$component_singular_title = $this->component->singular_title;
check_admin_referer( $this->get_row_nonce_name( $row_action, $item_id ) );
Method add_to_menu
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function add_to_menu( $args ) {
if ( ! $this->show_in_menu_manually ) {
return false;
}
Method run_bulk_action
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function run_bulk_action( $bulk_action, $item_ids ) {
$bulk_actions = $this->component->bulk_actions;
$component_plural_name = $this->component->title;
check_admin_referer( $this->get_bulk_nonce_name() );
Method validate_meta_values
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function validate_meta_values( $meta_values, $term_id ) {
$meta_values_validated = array();
$meta_values_old = array();
Method register
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register() {
if ( $this->registered ) {
return;
}
Method wpptd_get_term_meta_values
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wpptd_get_term_meta_values( $id, $single = null, $formatted = false ) {
if ( ! wpptd_supports_termmeta() ) {
return array();
}
Method add_taxonomies
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function add_taxonomies( $taxonomies, $post_type ) {
foreach ( $taxonomies as $taxonomy_slug => $taxonomy_args ) {
if ( is_array( $taxonomy_args ) ) {
$taxonomy = $post_type->add( new Taxonomy( $taxonomy_slug, $taxonomy_args ) );
if ( is_wp_error( $taxonomy ) ) {
Method get_labels_feminine
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function get_labels_feminine( $plural_name, $singular_name ) {
return array(
'name' => $plural_name,
'singular_name' => $singular_name,
'menu_name' => $plural_name,
Method get_labels_masculine
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function get_labels_masculine( $plural_name, $singular_name ) {
return array(
'name' => $plural_name,
'singular_name' => $singular_name,
'menu_name' => $plural_name,
Method maybe_register_related_objects_field
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function maybe_register_related_objects_field( $object, $args, $component, $component_parent ) {
if ( ! isset( $args['options'] ) || ! is_array( $args['options'] ) || 1 !== count( $args['options'] ) ) {
return;
}