Showing 241 of 364 total issues
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
File class-object-sync-sf-wordpress.php
has 1686 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Work with the WordPress data. This class can make read and write calls to the WordPress database, and also cache the responses.
*
* @class Object_Sync_Sf_WordPress
File class-object-sync-sf-salesforce-pull.php
has 1378 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Pull data from Salesforce into WordPress
*
* @class Object_Sync_Sf_Salesforce_Pull
Function map_params
has a Cognitive Complexity of 125 (exceeds 5 allowed). Consider refactoring. Open
public function map_params( $mapping, $object, $trigger, $use_soap = false, $is_new = true, $object_id_field = '' ) {
$params = array();
$has_missing_required_salesforce_field = 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
Method salesforce_push_sync_rest
has 490 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function salesforce_push_sync_rest( $object_type, $object, $mapping, $sf_sync_trigger ) {
// when using async, this task receives the WordPress object id value as an integer. otherwise, it receives the WordPress object data as an array.
if ( is_int( $object ) ) {
$wordpress_id = $object;
File class-object-sync-sf-salesforce-push.php
has 965 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Push data from WordPress into Salesforce
*
* @class Object_Sync_Sf_Salesforce_Push
Function salesforce_pull_process_records
has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring. Open
public function salesforce_pull_process_records( $object_type, $object, $sf_sync_trigger ) {
$sfapi = $this->salesforce['sfapi'];
if ( is_string( $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
Function salesforce_push_sync_rest
has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring. Open
public function salesforce_push_sync_rest( $object_type, $object, $mapping, $sf_sync_trigger ) {
// when using async, this task receives the WordPress object id value as an integer. otherwise, it receives the WordPress object data as an array.
if ( is_int( $object ) ) {
$wordpress_id = $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
File class-object-sync-sf-mapping.php
has 750 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Map objects and records between WordPress and Salesforce
*
* @class Object_Sync_Sf_Mapping
Function salesforce_push_object_crud
has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring. Open
private function salesforce_push_object_crud( $object_type, $object, $sf_sync_trigger, $manual = false ) {
$structure = $this->wordpress->get_wordpress_table_structure( $object_type );
$wordpress_id_field_name = $structure['id_field'];
- 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
File class-object-sync-sf-salesforce.php
has 686 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Authorize and communicate with the Salesforce REST API. This class can make read and write calls to Salesforce, and also cache the responses in WordPress.
*
* @class Object_Sync_Sf_Salesforce
Function get_updated_records
has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring. Open
private function get_updated_records() {
$sfapi = $this->salesforce['sfapi'];
foreach ( $this->mappings->get_fieldmaps( null, $this->mappings->active_fieldmap_conditions ) as $salesforce_mapping ) {
$map_sync_triggers = (array) $salesforce_mapping['sync_triggers']; // this sets which Salesforce triggers are allowed for the mapping.
$type = $salesforce_mapping['salesforce_object']; // this sets the Salesforce object type for the SOQL query.
- 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_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
File fieldmaps-add-edit-clone.php
has 592 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* The form to add and edit fieldmaps, which map a WordPress and Salesforce object type together.
*
* @package Object_Sync_Salesforce
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 salesforce_pull_process_records
has 239 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function salesforce_pull_process_records( $object_type, $object, $sf_sync_trigger ) {
$sfapi = $this->salesforce['sfapi'];
if ( is_string( $object ) ) {
Method create_called_from_salesforce
has 215 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function create_called_from_salesforce( $sf_sync_trigger, $synced_object, $params, $prematch, $wordpress_id_field_name, $seconds ) {
$salesforce_mapping = $synced_object['mapping'];
$object = $synced_object['salesforce_object'];
// methods to run the wp update operations.
Method get_updated_records
has 213 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function get_updated_records() {
$sfapi = $this->salesforce['sfapi'];
foreach ( $this->mappings->get_fieldmaps( null, $this->mappings->active_fieldmap_conditions ) as $salesforce_mapping ) {
$map_sync_triggers = (array) $salesforce_mapping['sync_triggers']; // this sets which Salesforce triggers are allowed for the mapping.
$type = $salesforce_mapping['salesforce_object']; // this sets the Salesforce object type for the SOQL query.
Function create_called_from_salesforce
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
private function create_called_from_salesforce( $sf_sync_trigger, $synced_object, $params, $prematch, $wordpress_id_field_name, $seconds ) {
$salesforce_mapping = $synced_object['mapping'];
$object = $synced_object['salesforce_object'];
// methods to run the wp update operations.
- 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"