File class-object-sync-sf-logging.php
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Log events based on plugin settings. Extend the WP_Logging class for the purposes of Object Sync for Salesforce.
*
* @class Object_Sync_Sf_Logging
Object_Sync_Sf_Logging
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Object_Sync_Sf_Logging extends WP_Logging {
/**
* Current version of the plugin
*
Method restrict_logs_by_type
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function restrict_logs_by_type( $post_type ) {
$type = 'wp_log';
$taxonomy = 'wp_log_type';
// only add filter to post type you want.
if ( 'wp_log' === $post_type ) {
Function setup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function setup( $title_or_params, $message = '', $trigger = 0, $parent = 0, $status = '' ) {
if ( is_array( $title_or_params ) ) {
$title = $title_or_params['title'];
$message = $title_or_params['message'];
- 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 set_log_slug
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function set_log_slug( $override_slug, $slug, $post_ID, $post_status, $post_type ) {
Method setup
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function setup( $title_or_params, $message = '', $trigger = 0, $parent = 0, $status = '' ) {
Function posts_filter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function posts_filter( $query ) {
global $pagenow;
$type = 'wp_log';
$taxonomy = 'wp_log_type';
if ( is_admin() && 'edit.php' === $pagenow ) {
- 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 check_log_schedule
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function check_log_schedule( $old_value, $new_value, $option ) {
$clear_schedule = false;
$schedule_unit = get_option( $this->option_prefix . 'logs_how_often_unit', '' );
$schedule_number = filter_var( get_option( $this->option_prefix . 'logs_how_often_number', '' ), FILTER_VALIDATE_INT );
if ( $this->option_prefix . 'logs_how_often_unit' === $option ) {
- 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 restrict_logs_by_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function restrict_logs_by_type( $post_type ) {
$type = 'wp_log';
$taxonomy = 'wp_log_type';
// only add filter to post type you want.
if ( 'wp_log' === $post_type ) {
- 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"