File class-object-sync-sf-admin.php
has 2018 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Create default WordPress admin functionality to configure the plugin.
*
* @class Object_Sync_Sf_Admin
Function show_admin_page
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
public function show_admin_page() {
$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_SPECIAL_CHARS );
echo '<div class="wrap">';
echo '<h1>' . esc_html( get_admin_page_title() ) . '</h1>';
$allowed = $this->check_wordpress_admin_permissions();
- 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 fields_settings
has 246 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function fields_settings( $page, $section, $callbacks ) {
add_settings_section( $page, ucwords( $page ), null, $page );
$salesforce_settings = array(
'consumer_key' => array(
'title' => __( 'Consumer Key', 'object-sync-for-salesforce' ),
Function import_json_file
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
public function import_json_file() {
if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_import'], 'object_sync_for_salesforce_nonce_import' ) ) {
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
Method show_admin_page
has 195 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show_admin_page() {
$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_SPECIAL_CHARS );
echo '<div class="wrap">';
echo '<h1>' . esc_html( get_admin_page_title() ) . '</h1>';
$allowed = $this->check_wordpress_admin_permissions();
Method fields_log_settings
has 181 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function fields_log_settings( $page, $section, $callbacks ) {
add_settings_section( $page, ucwords( str_replace( '_', ' ', $page ) ), null, $page );
$log_settings = array(
'enable_logging' => array(
'title' => __( 'Enable Logging?', 'object-sync-for-salesforce' ),
Object_Sync_Sf_Admin
has 49 functions (exceeds 20 allowed). Consider refactoring. Open
class Object_Sync_Sf_Admin {
/**
* Current version of the plugin
*
Method import_json_file
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function import_json_file() {
if ( ! wp_verify_nonce( $_POST['object_sync_for_salesforce_nonce_import'], 'object_sync_for_salesforce_nonce_import' ) ) {
return;
}
Function get_salesforce_object_description
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function get_salesforce_object_description( $data = array() ) {
$ajax = false;
if ( empty( $data ) ) {
$data = filter_input_array( INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS );
$ajax = true;
- 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 delete_object_map
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function delete_object_map() {
$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS );
if ( isset( $post_data['id'] ) ) {
$result = $this->mappings->delete_object_map( $post_data['id'] );
if ( true === $result ) {
- 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 fields_scheduling
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function fields_scheduling( $page, $section, $callbacks ) {
add_settings_section( 'batch', __( 'Batch Settings', 'object-sync-for-salesforce' ), null, $page );
$section = 'batch';
$schedule_settings = array(
Function get_salesforce_object_fields
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function get_salesforce_object_fields( $data = array() ) {
$ajax = false;
$post_data = filter_input_array( INPUT_POST, FILTER_UNSAFE_RAW );
if ( empty( $data ) ) {
$salesforce_object = isset( $post_data['salesforce_object'] ) ? sanitize_text_field( wp_unslash( $post_data['salesforce_object'] ) ) : '';
- 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 notices_data
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function notices_data() {
$notices = array(
'permission' => array(
'condition' => ( false === $this->check_wordpress_admin_permissions() ),
'message' => __( "Your account does not have permission to edit the Object Sync for Salesforce plugin's settings.", 'object-sync-for-salesforce' ),
Function prepare_fieldmap_data
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function prepare_fieldmap_data() {
$error = false;
$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS );
$cachekey = wp_json_encode( $post_data );
if ( false !== $cachekey ) {
- 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 show_salesforce_user_fields
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function show_salesforce_user_fields( $user ) {
$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_SPECIAL_CHARS );
if ( true === $this->check_wordpress_admin_permissions() ) {
$mappings = $this->mappings->load_all_by_wordpress( 'user', $user->ID );
$fieldmap = $this->mappings->get_fieldmaps(
- 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 prepare_object_map_data
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function prepare_object_map_data() {
$error = false;
$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS );
$cachekey = wp_json_encode( $post_data );
if ( false !== $cachekey ) {
- 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 resave_action_schedules
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resave_action_schedules() {
// for each schedulable action, go ahead and resave it.
$schedules_updated = array();
$schedules_restored = array();
foreach ( $this->schedulable_classes as $key => $value ) {
Function display_input_field
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function display_input_field( $args ) {
$type = $args['type'];
$id = $args['label_for'];
$name = $args['name'];
$desc = $args['desc'];
- 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 resave_action_schedules
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function resave_action_schedules() {
// for each schedulable action, go ahead and resave it.
$schedules_updated = array();
$schedules_restored = array();
foreach ( $this->schedulable_classes as $key => $value ) {
- 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 get_salesforce_object_fields
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_salesforce_object_fields( $data = array() ) {
$ajax = false;
$post_data = filter_input_array( INPUT_POST, FILTER_UNSAFE_RAW );
if ( empty( $data ) ) {
$salesforce_object = isset( $post_data['salesforce_object'] ) ? sanitize_text_field( wp_unslash( $post_data['salesforce_object'] ) ) : '';
Method display_input_field
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function display_input_field( $args ) {
$type = $args['type'];
$id = $args['label_for'];
$name = $args['name'];
$desc = $args['desc'];
Method delete_object_map
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delete_object_map() {
$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS );
if ( isset( $post_data['id'] ) ) {
$result = $this->mappings->delete_object_map( $post_data['id'] );
if ( true === $result ) {
Method get_salesforce_object_description
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_salesforce_object_description( $data = array() ) {
$ajax = false;
if ( empty( $data ) ) {
$data = filter_input_array( INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS );
$ajax = true;
Method prepare_fieldmap_data
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepare_fieldmap_data() {
$error = false;
$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS );
$cachekey = wp_json_encode( $post_data );
if ( false !== $cachekey ) {
Function status
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function status( $sfapi ) {
$contacts = $sfapi->query( 'SELECT Name, Id from Contact LIMIT 100' );
if ( 200 !== $contacts['code'] ) {
- 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_notices
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function display_notices() {
// before a notice is displayed, we should make sure we are on a page related to this plugin.
if ( ! isset( $_GET['page'] ) || $this->admin_settings_url_param !== $_GET['page'] ) {
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
Method display_select
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function display_select( $args ) {
$type = $args['type'];
$id = $args['label_for'];
$name = $args['name'];
$desc = $args['desc'];
Method display_checkboxes
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function display_checkboxes( $args ) {
$type = 'checkbox';
$name = $args['name'];
$options = get_option( $name, array() );
$group_desc = $args['desc'];
Method fields_errors
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function fields_errors( $page, $section, $callbacks ) {
add_settings_section( $section, __( 'Mapping Error Settings', 'object-sync-for-salesforce' ), null, $page );
$error_settings = array(
'errors_per_page' => array(
Method prepare_object_map_data
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepare_object_map_data() {
$error = false;
$post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS );
$cachekey = wp_json_encode( $post_data );
if ( false !== $cachekey ) {
Method status
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function status( $sfapi ) {
$contacts = $sfapi->query( 'SELECT Name, Id from Contact LIMIT 100' );
if ( 200 !== $contacts['code'] ) {
Function display_checkboxes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function display_checkboxes( $args ) {
$type = 'checkbox';
$name = $args['name'];
$options = get_option( $name, array() );
$group_desc = $args['desc'];
- 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 save_salesforce_user_fields
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function save_salesforce_user_fields( $user_id ) {
$post_data = filter_input_array( INPUT_POST, FILTER_UNSAFE_RAW );
if ( isset( $post_data['salesforce_update_mapped_user'] ) && true === filter_var( $post_data['salesforce_update_mapped_user'], FILTER_VALIDATE_BOOLEAN ) ) {
$mapping_objects = $this->mappings->get_all_object_maps(
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 tabs
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function tabs( $tabs, $tab = '' ) {
$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_SPECIAL_CHARS );
$consumer_key = $this->login_credentials['consumer_key'];
$consumer_secret = $this->login_credentials['consumer_secret'];
Method add_actions
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function add_actions() {
// settings link.
add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 5 );
Function display_select
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function display_select( $args ) {
$type = $args['type'];
$id = $args['label_for'];
$name = $args['name'];
$desc = $args['desc'];
- 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 show_salesforce_user_fields
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show_salesforce_user_fields( $user ) {
$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_SPECIAL_CHARS );
if ( true === $this->check_wordpress_admin_permissions() ) {
$mappings = $this->mappings->load_all_by_wordpress( 'user', $user->ID );
$fieldmap = $this->mappings->get_fieldmaps(
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct() {
$this->version = object_sync_for_salesforce()->version;
$this->file = object_sync_for_salesforce()->file;
$this->wpdb = object_sync_for_salesforce()->wpdb;
$this->slug = object_sync_for_salesforce()->slug;
Function tabs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function tabs( $tabs, $tab = '' ) {
$get_data = filter_input_array( INPUT_GET, FILTER_SANITIZE_SPECIAL_CHARS );
$consumer_key = $this->login_credentials['consumer_key'];
$consumer_secret = $this->login_credentials['consumer_secret'];
- 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 ( true === $this->salesforce['is_authorized'] ) {
echo sprintf(
'<a class="nav-tab%1$s" href="%2$s">%3$s</a>',
esc_attr( $active ),
esc_url( '?page=' . $this->admin_settings_url_param . '&tab=' . $tab_key ),
Consider simplifying this complex logical expression. Open
if ( empty( $error_fieldmaps ) && empty( $error_object_maps ) && ( ! empty( $successful_fieldmaps ) || ! empty( $successful_object_maps ) ) ) {
$this->clear_cache( false );
wp_safe_redirect( get_admin_url( null, 'options-general.php?page=' . $this->admin_settings_url_param . '&tab=import-export&data_saved=true' ) );
exit;
} elseif ( ! empty( $error_fieldmaps ) && ! empty( $successful_fieldmaps ) ) {
Function clear_cache
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function clear_cache( $ajax = false ) {
$result = $this->wordpress->sfwp_transients->flush();
$success = $result['success'];
if ( 0 < $result['count'] ) {
if ( true === $success ) {
- 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 push_to_salesforce
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function push_to_salesforce( $wordpress_object = '', $wordpress_id = '', $force_return = false ) {
$post_data = filter_input_array( INPUT_POST, FILTER_UNSAFE_RAW );
if ( empty( $wordpress_object ) && empty( $wordpress_id ) ) {
$wordpress_object = isset( $post_data['wordpress_object'] ) ? sanitize_text_field( wp_unslash( $post_data['wordpress_object'] ) ) : '';
$wordpress_id = isset( $post_data['wordpress_id'] ) ? absint( $post_data['wordpress_id'] ) : '';
- 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
Similar blocks of code found in 3 locations. Consider refactoring. Open
foreach ( $error_settings as $key => $attributes ) {
$id = $this->option_prefix . $key;
$name = $this->option_prefix . $key;
$title = $attributes['title'];
$callback = $attributes['callback'];
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 158.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
foreach ( $schedule_settings as $key => $attributes ) {
$id = $this->option_prefix . $key;
$name = $this->option_prefix . $key;
$title = $attributes['title'];
$callback = $attributes['callback'];
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 158.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
foreach ( $log_settings as $key => $attributes ) {
$id = $this->option_prefix . $key;
$name = $this->option_prefix . $key;
$title = $attributes['title'];
$callback = $attributes['callback'];
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 158.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( false === $result ) { // if the database didn't save, it's still an error.
$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
if ( '' !== $cachekey ) {
$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&mapping_error_transient=' . $cachekey;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 126.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( false === $result ) { // if the database didn't save, it's still an error.
$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
if ( '' !== $cachekey ) {
$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&map_transient=' . $cachekey;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 126.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( isset( $post_data['id'] ) ) {
$result = $this->mappings->delete_object_map( $post_data['id'] );
if ( true === $result ) {
$url = esc_url_raw( $post_data['redirect_url_success'] );
} else {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 96.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( $post_data['id'] ) {
$result = $this->mappings->delete_fieldmap( $post_data['id'] );
if ( true === $result ) {
$url = esc_url_raw( $post_data['redirect_url_success'] );
} else {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 96.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
foreach ( $error_object_maps as $mapping_object ) {
$body .= sprintf(
// translators: placeholders are: 1) the mapping object row ID, 2) the ID of the Salesforce object, 3) the WordPress object type.
'<li>' . esc_html__( 'Mapping object id (if it exists): %1$s. Salesforce Id: %2$s. WordPress object type: %3$s', 'object-sync-for-salesforce' ) . '</li>',
isset( $mapping_object['id'] ) ? absint( $mapping_object['id'] ) : '',
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 92.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
foreach ( $error_fieldmaps as $fieldmap ) {
$body .= sprintf(
// translators: placeholders are: 1) the fieldmap row ID, 2) the Salesforce object type, 3) the WordPress object type.
'<li>' . esc_html__( 'Fieldmap id (if it exists): %1$s. Salesforce object type: %2$s. WordPress object type: %3$s', 'object-sync-for-salesforce' ) . '</li>',
isset( $fieldmap['id'] ) ? absint( $fieldmap['id'] ) : '',
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 92.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76