MinnPost/object-sync-for-salesforce

View on GitHub

Showing 241 of 364 total issues

Method create_called_from_salesforce has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private function create_called_from_salesforce( $sf_sync_trigger, $synced_object, $params, $prematch, $wordpress_id_field_name, $seconds ) {
Severity: Minor
Found in classes/class-object-sync-sf-salesforce-pull.php - About 45 mins to fix

    Method map_params has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function map_params( $mapping, $object, $trigger, $use_soap = false, $is_new = true, $object_id_field = '' ) {
    Severity: Minor
    Found in classes/class-object-sync-sf-mapping.php - About 45 mins to fix

      Function post_update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private function post_update( $post_id, $params, $id_field = 'ID', $post_type = '' ) {
              $content              = array();
              $content[ $id_field ] = $post_id;
              foreach ( $params as $key => $value ) {
                  if ( 'wp_update_post' === $value['method_modify'] ) {
      Severity: Minor
      Found in classes/class-object-sync-sf-wordpress.php - About 45 mins to fix

      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 attachment_upsert has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private function attachment_upsert( $key, $value, $methods, $params, $id_field = 'ID', $check_only = false ) {
      Severity: Minor
      Found in classes/class-object-sync-sf-wordpress.php - About 45 mins to fix

        Function term_update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function term_update( $term_id, $params, $taxonomy, $id_field = 'ID' ) {
                if ( 'tag' === $taxonomy ) {
                    $taxonomy = 'post_tag';
                }
                $args = array();
        Severity: Minor
        Found in classes/class-object-sync-sf-wordpress.php - About 45 mins to fix

        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 __toString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __toString() {
        
                $query  = 'SELECT ';
                $query .= implode( ', ', $this->fields );
                $query .= ' FROM ' . $this->object_type;
        Severity: Minor
        Found in classes/class-object-sync-sf-salesforce-select-query.php - About 45 mins to fix

        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( $mapping['push_drafts'] ) || '1' !== $mapping['push_drafts'] ) && isset( $object['post_status'] ) && ( 'draft' === $object['post_status'] || ( 'inherit' === $object['post_status'] && 'attachment' !== $object['post_type'] ) ) ) {
                        // skip this object if it is a draft and the fieldmap settings told us to ignore it.
                        continue;
                    }
        Severity: Major
        Found in classes/class-object-sync-sf-salesforce-push.php - About 40 mins to fix

          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 ),
          Severity: Major
          Found in classes/class-object-sync-sf-admin.php - About 40 mins to fix

            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 ) ) {
            Severity: Major
            Found in classes/class-object-sync-sf-admin.php - About 40 mins to fix

              Method delete_called_from_salesforce has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private function delete_called_from_salesforce( $sf_sync_trigger, $synced_object, $wordpress_id_field_name, $seconds, $mapping_objects ) {
              Severity: Minor
              Found in classes/class-object-sync-sf-salesforce-pull.php - About 35 mins to fix

                Method is_push_allowed has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    private function is_push_allowed( $object_type, $object, $sf_sync_trigger, $mapping, $map_sync_triggers ) {
                Severity: Minor
                Found in classes/class-object-sync-sf-salesforce-push.php - About 35 mins to fix

                  Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function __construct( $condition, $message, $dismissible, $type, $template ) {
                  Severity: Minor
                  Found in classes/class-object-sync-sf-admin-notice.php - About 35 mins to fix

                    Method setup has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function setup( $title_or_params, $message = '', $trigger = 0, $parent = 0, $status = '' ) {
                    Severity: Minor
                    Found in classes/class-object-sync-sf-logging.php - About 35 mins to fix

                      Method update_called_from_salesforce has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          private function update_called_from_salesforce( $sf_sync_trigger, $synced_object, $params, $wordpress_id_field_name, $seconds ) {
                      Severity: Minor
                      Found in classes/class-object-sync-sf-salesforce-pull.php - About 35 mins to fix

                        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 ) {
                        Severity: Minor
                        Found in classes/class-object-sync-sf-logging.php - About 35 mins to fix

                          Method schedule_cron has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public function schedule_cron( $timestamp, $cron_schedule, $hook, $args = array(), $group = '' ) {
                          Severity: Minor
                          Found in classes/class-object-sync-sf-queue.php - About 35 mins to fix

                            Method legacy_transient_upgrade has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                private function legacy_transient_upgrade( $operation, $object_type = '', $fieldmap_id = '', $value = '', $expiration = 0 ) {
                            Severity: Minor
                            Found in classes/class-object-sync-sf-sync-transients.php - About 35 mins to fix

                              Method set has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public function set( $operation, $object_type = '', $fieldmap_id = '', $value = '', $expiration = 0 ) {
                              Severity: Minor
                              Found in classes/class-object-sync-sf-sync-transients.php - About 35 mins to fix

                                Method http_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    protected function http_request( $url, $data, $headers = array(), $method = 'GET', $options = array() ) {
                                Severity: Minor
                                Found in classes/class-object-sync-sf-salesforce.php - About 35 mins to fix

                                  Method legacy_option_upgrade has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      private function legacy_option_upgrade( $operation, $object_type = '', $fieldmap_id = '', $value = '', $autoload = true ) {
                                  Severity: Minor
                                  Found in classes/class-object-sync-sf-pull-options.php - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language