MinnPost/object-sync-for-salesforce

View on GitHub
classes/class-object-sync-sf-wordpress.php

Summary

Maintainability
F
3 wks
Test Coverage

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
Severity: Major
Found in classes/class-object-sync-sf-wordpress.php - About 4 days to fix

    Function comment_upsert has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

        private function comment_upsert( $key, $value, $methods, $params, $id_field = 'comment_ID', $pull_to_drafts = false, $check_only = false ) {
            $method = isset( $methods['method_match'] ) ? $methods['method_match'] : '';
            if ( 'get_comment' === $method ) {
                $method = 'get_comments';
            }
    Severity: Minor
    Found in classes/class-object-sync-sf-wordpress.php - About 6 hrs 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 post_upsert has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

        private function post_upsert( $key, $value, $methods, $params, $id_field = 'ID', $pull_to_drafts = false, $post_type = 'post', $check_only = false ) {
    
            $method = isset( $methods['method_match'] ) ? $methods['method_match'] : '';
            if ( '' !== $method ) {
                // By default, posts use get_posts as the method. args can be like this.
    Severity: Minor
    Found in classes/class-object-sync-sf-wordpress.php - About 6 hrs 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 get_wordpress_table_structure has 154 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function get_wordpress_table_structure( $object_type ) {
            if ( 'attachment' === $object_type ) {
                $object_table_structure = array(
                    'object_name'     => 'post',
                    'content_methods' => array(
    Severity: Major
    Found in classes/class-object-sync-sf-wordpress.php - About 6 hrs to fix

      Function term_upsert has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

          private function term_upsert( $key, $value, $methods, $params, $taxonomy, $id_field = 'ID', $pull_to_drafts = false, $check_only = false ) {
              if ( 'tag' === $taxonomy ) {
                  $taxonomy = 'post_tag';
              }
              $method = isset( $methods['method_match'] ) ? $methods['method_match'] : '';
      Severity: Minor
      Found in classes/class-object-sync-sf-wordpress.php - About 6 hrs 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 attachment_upsert has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

          private function attachment_upsert( $key, $value, $methods, $params, $id_field = 'ID', $check_only = false ) {
      
              $method = isset( $methods['method_match'] ) ? $methods['method_match'] : '';
              if ( '' !== $method ) {
                  // Get_posts is more helpful here, so that is the method attachment uses for 'read'.
      Severity: Minor
      Found in classes/class-object-sync-sf-wordpress.php - About 5 hrs 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 user_upsert has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          private function user_upsert( $key, $value, $methods, $params, $id_field = 'ID', $pull_to_drafts = false, $check_only = false ) {
      
              // If the key is user_email, we need to make it just email because that is how the WordPress method reads it.
              $method = isset( $methods['method_match'] ) ? $methods['method_match'] : '';
              if ( '' !== $method ) {
      Severity: Minor
      Found in classes/class-object-sync-sf-wordpress.php - About 5 hrs 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

      Object_Sync_Sf_WordPress has 38 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Object_Sync_Sf_WordPress {
      
          /**
           * Current version of the plugin
           *
      Severity: Minor
      Found in classes/class-object-sync-sf-wordpress.php - About 5 hrs to fix

        Method comment_upsert has 123 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function comment_upsert( $key, $value, $methods, $params, $id_field = 'comment_ID', $pull_to_drafts = false, $check_only = false ) {
                $method = isset( $methods['method_match'] ) ? $methods['method_match'] : '';
                if ( 'get_comment' === $method ) {
                    $method = 'get_comments';
                }
        Severity: Major
        Found in classes/class-object-sync-sf-wordpress.php - About 4 hrs to fix

          Method post_upsert has 112 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function post_upsert( $key, $value, $methods, $params, $id_field = 'ID', $pull_to_drafts = false, $post_type = 'post', $check_only = false ) {
          
                  $method = isset( $methods['method_match'] ) ? $methods['method_match'] : '';
                  if ( '' !== $method ) {
                      // By default, posts use get_posts as the method. args can be like this.
          Severity: Major
          Found in classes/class-object-sync-sf-wordpress.php - About 4 hrs to fix

            Method attachment_upsert has 107 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function attachment_upsert( $key, $value, $methods, $params, $id_field = 'ID', $check_only = false ) {
            
                    $method = isset( $methods['method_match'] ) ? $methods['method_match'] : '';
                    if ( '' !== $method ) {
                        // Get_posts is more helpful here, so that is the method attachment uses for 'read'.
            Severity: Major
            Found in classes/class-object-sync-sf-wordpress.php - About 4 hrs to fix

              Method term_upsert has 97 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function term_upsert( $key, $value, $methods, $params, $taxonomy, $id_field = 'ID', $pull_to_drafts = false, $check_only = false ) {
                      if ( 'tag' === $taxonomy ) {
                          $taxonomy = 'post_tag';
                      }
                      $method = isset( $methods['method_match'] ) ? $methods['method_match'] : '';
              Severity: Major
              Found in classes/class-object-sync-sf-wordpress.php - About 3 hrs to fix

                Method user_upsert has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function user_upsert( $key, $value, $methods, $params, $id_field = 'ID', $pull_to_drafts = false, $check_only = false ) {
                
                        // If the key is user_email, we need to make it just email because that is how the WordPress method reads it.
                        $method = isset( $methods['method_match'] ) ? $methods['method_match'] : '';
                        if ( '' !== $method ) {
                Severity: Major
                Found in classes/class-object-sync-sf-wordpress.php - About 3 hrs to fix

                  Function update_wp_meta has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function update_wp_meta( $params, $parent_object_id, $parent_object_type ) {
                          $success = true;
                          $changed = false;
                          $errors  = array();
                          if ( ! is_wp_error( $parent_object_id ) && is_array( $params ) && ! empty( $params ) ) {
                  Severity: Minor
                  Found in classes/class-object-sync-sf-wordpress.php - About 3 hrs 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 object_fields has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function object_fields( $object_name, $id_field, $content_table, $content_methods, $meta_table, $meta_methods, $where, $ignore_keys = array() ) {
                          // These two queries load all the fields from the specified object unless they have been specified as ignore fields.
                          // They also load the fields that are meta_keys from the specified object's meta table.
                          // Maybe a box for a custom query, since custom fields get done in so many ways.
                          // Eventually this would be the kind of thing we could use fields api for, if it ever gets done.
                  Severity: Minor
                  Found in classes/class-object-sync-sf-wordpress.php - About 3 hrs 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 attachment_update has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function attachment_update( $attachment_id, $params, $id_field = 'ID' ) {
                          $content              = array();
                          $content[ $id_field ] = $attachment_id;
                          foreach ( $params as $key => $value ) {
                              if ( 'wp_insert_attachment' === $value['method_modify'] ) { // Should also be insert attachment maybe.
                  Severity: Minor
                  Found in classes/class-object-sync-sf-wordpress.php - About 2 hrs 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 object_fields has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function object_fields( $object_name, $id_field, $content_table, $content_methods, $meta_table, $meta_methods, $where, $ignore_keys = array() ) {
                          // These two queries load all the fields from the specified object unless they have been specified as ignore fields.
                          // They also load the fields that are meta_keys from the specified object's meta table.
                          // Maybe a box for a custom query, since custom fields get done in so many ways.
                          // Eventually this would be the kind of thing we could use fields api for, if it ever gets done.
                  Severity: Major
                  Found in classes/class-object-sync-sf-wordpress.php - About 2 hrs to fix

                    Function post_create has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function post_create( $params, $id_field = 'ID', $post_type = 'post' ) {
                            // Load all params with a method_modify of the object structure's content_method into $content.
                            $content   = array();
                            $structure = $this->get_wordpress_table_structure( $post_type );
                            foreach ( $params as $key => $value ) {
                    Severity: Minor
                    Found in classes/class-object-sync-sf-wordpress.php - About 2 hrs 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_update has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function attachment_update( $attachment_id, $params, $id_field = 'ID' ) {
                            $content              = array();
                            $content[ $id_field ] = $attachment_id;
                            foreach ( $params as $key => $value ) {
                                if ( 'wp_insert_attachment' === $value['method_modify'] ) { // Should also be insert attachment maybe.
                    Severity: Major
                    Found in classes/class-object-sync-sf-wordpress.php - About 2 hrs to fix

                      Method post_create has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function post_create( $params, $id_field = 'ID', $post_type = 'post' ) {
                              // Load all params with a method_modify of the object structure's content_method into $content.
                              $content   = array();
                              $structure = $this->get_wordpress_table_structure( $post_type );
                              foreach ( $params as $key => $value ) {
                      Severity: Major
                      Found in classes/class-object-sync-sf-wordpress.php - About 2 hrs to fix

                        Function user_create has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function user_create( $params, $id_field = 'ID' ) {
                        
                                // Allow username to be email address or username.
                                // The username could be autogenerated before this point for the sake of URLs.
                                $username      = $params['user_email']['value'];
                        Severity: Minor
                        Found in classes/class-object-sync-sf-wordpress.php - About 2 hrs 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 user_create has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function user_create( $params, $id_field = 'ID' ) {
                        
                                // Allow username to be email address or username.
                                // The username could be autogenerated before this point for the sake of URLs.
                                $username      = $params['user_email']['value'];
                        Severity: Major
                        Found in classes/class-object-sync-sf-wordpress.php - About 2 hrs to fix

                          Method comment_create has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function comment_create( $params, $id_field = 'comment_ID' ) {
                                  // Load all params with a method_modify of the object structure's content_method into $content.
                                  $content   = array();
                                  $structure = $this->get_wordpress_table_structure( 'comment' );
                                  foreach ( $params as $key => $value ) {
                          Severity: Minor
                          Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                            Method object_upsert has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function object_upsert( $name, $key, $value, $methods, $params, $pull_to_drafts = false, $check_only = false ) {
                            
                                    $structure = $this->get_wordpress_table_structure( $name );
                                    $id_field  = $structure['id_field'];
                            
                            
                            Severity: Minor
                            Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                              Method update_wp_meta has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function update_wp_meta( $params, $parent_object_id, $parent_object_type ) {
                                      $success = true;
                                      $changed = false;
                                      $errors  = array();
                                      if ( ! is_wp_error( $parent_object_id ) && is_array( $params ) && ! empty( $params ) ) {
                              Severity: Minor
                              Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                Method attachment_create has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private function attachment_create( $params, $id_field = 'ID' ) {
                                        // Load all params with a method_modify of the object structure's content_method into $content.
                                        $content   = array();
                                        $structure = $this->get_wordpress_table_structure( 'attachment' );
                                        // WP requires post_title, post_content (can be empty), post_status, and post_mime_type to create an attachment.
                                Severity: Minor
                                Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                  Method term_create has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      private function term_create( $params, $taxonomy, $id_field = 'ID' ) {
                                          if ( 'tag' === $taxonomy ) {
                                              $taxonomy = 'post_tag';
                                          }
                                          // Load all params with a method_modify of the object structure's content_method into $content.
                                  Severity: Minor
                                  Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                    Method object_delete has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function object_delete( $name, $id ) {
                                            $structure = $this->get_wordpress_table_structure( $name );
                                            $id_field  = $structure['id_field'];
                                    
                                            switch ( $name ) {
                                    Severity: Minor
                                    Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                      Function attachment_create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          private function attachment_create( $params, $id_field = 'ID' ) {
                                              // Load all params with a method_modify of the object structure's content_method into $content.
                                              $content   = array();
                                              $structure = $this->get_wordpress_table_structure( 'attachment' );
                                              // WP requires post_title, post_content (can be empty), post_status, and post_mime_type to create an attachment.
                                      Severity: Minor
                                      Found in classes/class-object-sync-sf-wordpress.php - About 1 hr 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 object_update has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function object_update( $name, $id, $params, $mapping_object = array() ) {
                                      
                                              $structure = $this->get_wordpress_table_structure( $name );
                                              $id_field  = $structure['id_field'];
                                      
                                      
                                      Severity: Minor
                                      Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                        Method object_create has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            public function object_create( $name, $params ) {
                                        
                                                $structure = $this->get_wordpress_table_structure( $name );
                                                $id_field  = $structure['id_field'];
                                        
                                        
                                        Severity: Minor
                                        Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                          Method term_update has 36 lines of code (exceeds 25 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 1 hr to fix

                                            Method get_wordpress_object_data has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                public function get_wordpress_object_data( $object_type, $object_id, $is_deleted = false ) {
                                                    $wordpress_object       = array();
                                                    $object_table_structure = $this->get_wordpress_table_structure( $object_type );
                                            
                                                    $meta_table      = $object_table_structure['meta_table'];
                                            Severity: Minor
                                            Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                              Function comment_create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  private function comment_create( $params, $id_field = 'comment_ID' ) {
                                                      // Load all params with a method_modify of the object structure's content_method into $content.
                                                      $content   = array();
                                                      $structure = $this->get_wordpress_table_structure( 'comment' );
                                                      foreach ( $params as $key => $value ) {
                                              Severity: Minor
                                              Found in classes/class-object-sync-sf-wordpress.php - About 1 hr 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 user_update has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  private function user_update( $user_id, $params, $id_field = 'ID' ) {
                                                      $content              = array();
                                                      $content[ $id_field ] = $user_id;
                                                      foreach ( $params as $key => $value ) {
                                              
                                              
                                              Severity: Minor
                                              Found in classes/class-object-sync-sf-wordpress.php - About 1 hr 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 term_create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  private function term_create( $params, $taxonomy, $id_field = 'ID' ) {
                                                      if ( 'tag' === $taxonomy ) {
                                                          $taxonomy = 'post_tag';
                                                      }
                                                      // Load all params with a method_modify of the object structure's content_method into $content.
                                              Severity: Minor
                                              Found in classes/class-object-sync-sf-wordpress.php - About 1 hr 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 user_update has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                  private function user_update( $user_id, $params, $id_field = 'ID' ) {
                                                      $content              = array();
                                                      $content[ $id_field ] = $user_id;
                                                      foreach ( $params as $key => $value ) {
                                              
                                              
                                              Severity: Minor
                                              Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                                Method post_update has 33 lines of code (exceeds 25 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 1 hr to fix

                                                  Method comment_update has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                      private function comment_update( $comment_id, $params, $id_field = 'comment_ID' ) {
                                                          $content              = array();
                                                          $content[ $id_field ] = $comment_id;
                                                          foreach ( $params as $key => $value ) {
                                                              if ( 'wp_update_comment' === $value['method_modify'] ) {
                                                  Severity: Minor
                                                  Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                                    Method get_wordpress_object_fields has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                        public function get_wordpress_object_fields( $wordpress_object, $id_field = 'ID' ) {
                                                    
                                                            $object_table_structure = $this->get_wordpress_table_structure( $wordpress_object );
                                                    
                                                            $meta_table      = $object_table_structure['meta_table'];
                                                    Severity: Minor
                                                    Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                                      Function create_wp_meta has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          private function create_wp_meta( $params, $parent_object_id, $parent_object_type ) {
                                                              $success = true;
                                                              $errors  = array();
                                                              if ( ! is_wp_error( $parent_object_id ) && is_array( $params ) && ! empty( $params ) ) {
                                                                  foreach ( $params as $key => $value ) {
                                                      Severity: Minor
                                                      Found in classes/class-object-sync-sf-wordpress.php - About 1 hr 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 create_wp_meta has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                          private function create_wp_meta( $params, $parent_object_id, $parent_object_type ) {
                                                              $success = true;
                                                              $errors  = array();
                                                              if ( ! is_wp_error( $parent_object_id ) && is_array( $params ) && ! empty( $params ) ) {
                                                                  foreach ( $params as $key => $value ) {
                                                      Severity: Minor
                                                      Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                                        Function object_upsert has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                            public function object_upsert( $name, $key, $value, $methods, $params, $pull_to_drafts = false, $check_only = false ) {
                                                        
                                                                $structure = $this->get_wordpress_table_structure( $name );
                                                                $id_field  = $structure['id_field'];
                                                        
                                                        
                                                        Severity: Minor
                                                        Found in classes/class-object-sync-sf-wordpress.php - About 1 hr 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 get_wordpress_object_fields has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                            public function get_wordpress_object_fields( $wordpress_object, $id_field = 'ID' ) {
                                                        
                                                                $object_table_structure = $this->get_wordpress_table_structure( $wordpress_object );
                                                        
                                                                $meta_table      = $object_table_structure['meta_table'];
                                                        Severity: Minor
                                                        Found in classes/class-object-sync-sf-wordpress.php - About 1 hr 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 object_fields has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                        Open

                                                            private function object_fields( $object_name, $id_field, $content_table, $content_methods, $meta_table, $meta_methods, $where, $ignore_keys = array() ) {
                                                        Severity: Major
                                                        Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                                          Method post_upsert has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                          Open

                                                              private function post_upsert( $key, $value, $methods, $params, $id_field = 'ID', $pull_to_drafts = false, $post_type = 'post', $check_only = false ) {
                                                          Severity: Major
                                                          Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                                            Method term_upsert has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                            Open

                                                                private function term_upsert( $key, $value, $methods, $params, $taxonomy, $id_field = 'ID', $pull_to_drafts = false, $check_only = false ) {
                                                            Severity: Major
                                                            Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

                                                              Function get_wordpress_table_structure has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                              Open

                                                                  public function get_wordpress_table_structure( $object_type ) {
                                                                      if ( 'attachment' === $object_type ) {
                                                                          $object_table_structure = array(
                                                                              'object_name'     => 'post',
                                                                              'content_methods' => array(
                                                              Severity: Minor
                                                              Found in classes/class-object-sync-sf-wordpress.php - About 55 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 object_delete has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                              Open

                                                                  public function object_delete( $name, $id ) {
                                                                      $structure = $this->get_wordpress_table_structure( $name );
                                                                      $id_field  = $structure['id_field'];
                                                              
                                                                      switch ( $name ) {
                                                              Severity: Minor
                                                              Found in classes/class-object-sync-sf-wordpress.php - About 55 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 get_wordpress_object_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                              Open

                                                                  public function get_wordpress_object_data( $object_type, $object_id, $is_deleted = false ) {
                                                                      $wordpress_object       = array();
                                                                      $object_table_structure = $this->get_wordpress_table_structure( $object_type );
                                                              
                                                                      $meta_table      = $object_table_structure['meta_table'];
                                                              Severity: Minor
                                                              Found in classes/class-object-sync-sf-wordpress.php - About 55 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 object_update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                              Open

                                                                  public function object_update( $name, $id, $params, $mapping_object = array() ) {
                                                              
                                                                      $structure = $this->get_wordpress_table_structure( $name );
                                                                      $id_field  = $structure['id_field'];
                                                              
                                                              
                                                              Severity: Minor
                                                              Found in classes/class-object-sync-sf-wordpress.php - About 55 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 object_create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                              Open

                                                                  public function object_create( $name, $params ) {
                                                              
                                                                      $structure = $this->get_wordpress_table_structure( $name );
                                                                      $id_field  = $structure['id_field'];
                                                              
                                                              
                                                              Severity: Minor
                                                              Found in classes/class-object-sync-sf-wordpress.php - About 55 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 comment_upsert has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                              Open

                                                                  private function comment_upsert( $key, $value, $methods, $params, $id_field = 'comment_ID', $pull_to_drafts = false, $check_only = false ) {
                                                              Severity: Major
                                                              Found in classes/class-object-sync-sf-wordpress.php - About 50 mins to fix

                                                                Method user_upsert has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                                Open

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

                                                                  Method object_upsert has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                                  Open

                                                                      public function object_upsert( $name, $key, $value, $methods, $params, $pull_to_drafts = false, $check_only = false ) {
                                                                  Severity: Major
                                                                  Found in classes/class-object-sync-sf-wordpress.php - About 50 mins to fix

                                                                    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 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

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

                                                                          private function comment_update( $comment_id, $params, $id_field = 'comment_ID' ) {
                                                                              $content              = array();
                                                                              $content[ $id_field ] = $comment_id;
                                                                              foreach ( $params as $key => $value ) {
                                                                                  if ( 'wp_update_comment' === $value['method_modify'] ) {
                                                                      Severity: Minor
                                                                      Found in classes/class-object-sync-sf-wordpress.php - About 35 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

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                      return $existing_id;
                                                                      Severity: Major
                                                                      Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                    return $result;
                                                                        Severity: Major
                                                                        Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                      return $result;
                                                                          Severity: Major
                                                                          Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                        return $result;
                                                                            Severity: Major
                                                                            Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                          return $result;
                                                                              Severity: Major
                                                                              Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                                return $existing_id;
                                                                                Severity: Major
                                                                                Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                                  return $existing_id;
                                                                                  Severity: Major
                                                                                  Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                    return $existing_id;
                                                                                    Severity: Major
                                                                                    Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                      return $existing_id;
                                                                                      Severity: Major
                                                                                      Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                    return $result;
                                                                                        Severity: Major
                                                                                        Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                      return $result;
                                                                                          Severity: Major
                                                                                          Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                        return $result;
                                                                                            Severity: Major
                                                                                            Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                                                                                              Function object_edit_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                              Open

                                                                                                  public function object_edit_link( $object_type, $wordpress_id ) {
                                                                                                      $edit_link = '';
                                                                                                      if ( 'user' === $object_type ) {
                                                                                                          $edit_link = get_edit_user_link( $wordpress_id );
                                                                                                      } elseif ( 'post' === $object_type || 'page' === $object_type || 'attachment' === $object_type ) {
                                                                                              Severity: Minor
                                                                                              Found in classes/class-object-sync-sf-wordpress.php - About 25 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

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                      if ( is_wp_error( $post_id ) ) {
                                                                                                          $success = false;
                                                                                                          $errors  = $post_id;
                                                                                                      } else {
                                                                                                          // If it's a custom record type, fix the methods.
                                                                                              Severity: Major
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 1 other location - About 3 hrs to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 1529..1543

                                                                                              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 143.

                                                                                              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

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                              Open

                                                                                                      if ( 'attachment' === $object_type ) {
                                                                                                          $object_table_structure = array(
                                                                                                              'object_name'     => 'post',
                                                                                                              'content_methods' => array(
                                                                                                                  'create' => 'wp_insert_attachment',
                                                                                              Severity: Major
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 2 other locations - About 3 hrs to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 234..258
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 307..331

                                                                                              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 143.

                                                                                              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

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                              Open

                                                                                                      } else { // This is for custom post types.
                                                                                                          $object_table_structure = array(
                                                                                                              'object_name'     => 'post',
                                                                                                              'content_methods' => array(
                                                                                                                  'create' => 'wp_insert_post',
                                                                                              Severity: Major
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 2 other locations - About 3 hrs to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 174..331
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 234..258

                                                                                              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 143.

                                                                                              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

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                      if ( is_wp_error( $post_id ) ) {
                                                                                                          $success = false;
                                                                                                          $errors  = $post_id;
                                                                                                      } else {
                                                                                                          // If it's a custom record type, fix the methods.
                                                                                              Severity: Major
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 1 other location - About 3 hrs to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 1296..1310

                                                                                              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 143.

                                                                                              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

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                              Open

                                                                                                      } elseif ( 'post' === $object_type ) {
                                                                                                          $object_table_structure = array(
                                                                                                              'object_name'     => 'post',
                                                                                                              'content_methods' => array(
                                                                                                                  'create' => 'wp_insert_post',
                                                                                              Severity: Major
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 2 other locations - About 3 hrs to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 174..331
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 307..331

                                                                                              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 143.

                                                                                              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

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                      if ( is_wp_error( $term ) ) {
                                                                                                          $success = false;
                                                                                                          $errors  = $term;
                                                                                                      } else {
                                                                                                          $term_id     = $term[ "$id_field" ];
                                                                                              Severity: Major
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 1 other location - About 1 hr to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 1951..1961

                                                                                              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 111.

                                                                                              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

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                      if ( is_wp_error( $term ) ) {
                                                                                                          $success = false;
                                                                                                          $errors  = $term;
                                                                                                      } else {
                                                                                                          $term_id     = $term[ "$id_field" ];
                                                                                              Severity: Major
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 1 other location - About 1 hr to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 2153..2163

                                                                                              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 111.

                                                                                              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

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                          if ( isset( $posts ) && isset( $posts[0]->{$id_field} ) ) {
                                                                                                              // Post does exist after checking the matching value. We want its id.
                                                                                                              $post_id = $posts[0]->{$id_field};
                                                                                              
                                                                                                              if ( true === $check_only ) {
                                                                                              Severity: Major
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 1 other location - About 1 hr to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 2025..2063

                                                                                              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 101.

                                                                                              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

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                          if ( isset( $term ) && isset( $term->{$id_field} ) ) {
                                                                                                              // Term does exist after checking the matching value. we want its id.
                                                                                                              $term_id = $term->{$id_field};
                                                                                              
                                                                                                              if ( true === $check_only ) {
                                                                                              Severity: Major
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 1 other location - About 1 hr to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 1391..1429

                                                                                              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 101.

                                                                                              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

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                      if ( is_wp_error( $comment_id ) ) {
                                                                                                          $success = false;
                                                                                                          $errors  = $comment_id;
                                                                                                      } else {
                                                                                                          $meta_result = $this->create_wp_meta( $params, $comment_id, 'comment' );
                                                                                              Severity: Minor
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 1 other location - About 55 mins to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 1206..1215

                                                                                              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 98.

                                                                                              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

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                      if ( is_wp_error( $user_id ) ) {
                                                                                                          $success = false;
                                                                                                          $errors  = $user_id;
                                                                                                      } else {
                                                                                                          $meta_result = $this->update_wp_meta( $params, $user_id, 'user' );
                                                                                              Severity: Minor
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 1 other location - About 55 mins to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 2243..2252

                                                                                              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 98.

                                                                                              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

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                          if ( isset( $posts ) && isset( $posts[0]->{$id_field} ) ) {
                                                                                                              // Attachment does exist after checking the matching value. we want its id.
                                                                                                              $attachment_id = $posts[0]->{$id_field};
                                                                                              
                                                                                                              if ( true === $check_only ) {
                                                                                              Severity: Minor
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 1 other location - About 55 mins to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 1391..1429

                                                                                              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 98.

                                                                                              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

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                          if ( isset( $user ) && isset( $user->{$id_field} ) ) {
                                                                                                              // User does exist after checking the matching value. we want its id.
                                                                                                              $user_id = $user->{$id_field};
                                                                                              
                                                                                                              if ( true === $check_only ) {
                                                                                              Severity: Minor
                                                                                              Found in classes/class-object-sync-sf-wordpress.php and 1 other location - About 45 mins to fix
                                                                                              classes/class-object-sync-sf-wordpress.php on lines 1698..1736

                                                                                              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 95.

                                                                                              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

                                                                                              Further Reading

                                                                                              Use placeholders and $wpdb->prepare(); found interpolated variable $tax_table at "DESC {$tax_table}"
                                                                                              Open

                                                                                                          $taxonomy = $this->wpdb->get_col( "DESC {$tax_table}", 0 );

                                                                                              Use placeholders and $wpdb->prepare(); found interpolated variable $content_table at "DESC {$content_table}"
                                                                                              Open

                                                                                                      $data_fields      = $this->wpdb->get_col( "DESC {$content_table}", 0 );

                                                                                              Use placeholders and $wpdb->prepare(); found interpolated variable $content_table at "DESC {$content_table}"
                                                                                              Open

                                                                                                      $data_field_types = $this->wpdb->get_col( "DESC {$content_table}", 1 ); // get the database field types.

                                                                                              Use placeholders and $wpdb->prepare(); found $select_meta
                                                                                              Open

                                                                                                      $meta_fields = $this->wpdb->get_results( $select_meta );

                                                                                              There are no issues that match your filters.

                                                                                              Category
                                                                                              Status