MinnPost/object-sync-for-salesforce

View on GitHub

Showing 364 of 364 total issues

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

    public function api_call( $path, $params = array(), $method = 'GET', $options = array(), $type = 'rest' ) {
        if ( ! $this->get_access_token() ) {
            $this->refresh_token();
        }
        $this->response = $this->api_http_request( $path, $params, $method, $options, $type );
Severity: Minor
Found in classes/class-object-sync-sf-salesforce.php - About 1 hr to fix

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

        private function status( $sfapi ) {
    
            $contacts = $sfapi->query( 'SELECT Name, Id from Contact LIMIT 100' );
    
            if ( 200 !== $contacts['code'] ) {
    Severity: Minor
    Found in classes/class-object-sync-sf-admin.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 log_trigger_settings has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function log_trigger_settings() {
                  $triggers_to_log = get_option( $this->option_prefix . 'triggers_to_log', array() );
                  if ( ! empty( $triggers_to_log ) ) {
                      // in version 2.0.0 of this plugin, we replaced the bit flags with strings to make them more legible.
                      // when the database version changes to 2.0.0, we should update the option value to use the new strings.
          Severity: Minor
          Found in classes/class-object-sync-sf-activate.php - About 1 hr to fix

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

                private function respond_to_salesforce_merge( $object_type, $merged_record ) {
                    $op = 'Merge';
                    if ( isset( $merged_record['Id'] ) && true === filter_var( $merged_record['sf:IsDeleted'], FILTER_VALIDATE_BOOLEAN ) && '' !== $merged_record['sf:MasterRecordId'] ) {
                        $previous_sf_id  = $merged_record['Id'];
                        $new_sf_id       = $merged_record['sf:MasterRecordId'];
            Severity: Minor
            Found in classes/class-object-sync-sf-salesforce-pull.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

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

                function wp_readme_visibility( $string ) {
                    // Remove github comment.
                    $string = preg_replace( '#<!-- only:github/ -->(.*?)<!-- /only:github -->#us', '', $string );
                    // Display WordPress comment.
                    $string = preg_replace_callback(
                Severity: Minor
                Found in bin/wp-readme.php - About 1 hr to fix

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

                      public function check_for_action_scheduler( $upgrader_object, $hook_extra ) {
                  
                          // skip if this action isn't this plugin being updated.
                          if ( 'plugin' !== $hook_extra['type'] && 'update' !== $hook_extra['action'] && $hook_extra['plugin'] !== $this->slug ) {
                              return;
                  Severity: Minor
                  Found in classes/class-object-sync-sf-activate.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 api_call has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function api_call( $path, $params = array(), $method = 'GET', $options = array(), $type = 'rest' ) {
                          if ( ! $this->get_access_token() ) {
                              $this->refresh_token();
                          }
                          $this->response = $this->api_http_request( $path, $params, $method, $options, $type );
                  Severity: Minor
                  Found in classes/class-object-sync-sf-salesforce.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 display_checkboxes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function display_checkboxes( $args ) {
                          $type       = 'checkbox';
                          $name       = $args['name'];
                          $options    = get_option( $name, array() );
                          $group_desc = $args['desc'];
                  Severity: Minor
                  Found in classes/class-object-sync-sf-admin.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 save_salesforce_user_fields has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function save_salesforce_user_fields( $user_id ) {
                          $post_data = filter_input_array( INPUT_POST, FILTER_UNSAFE_RAW );
                          if ( isset( $post_data['salesforce_update_mapped_user'] ) && true === filter_var( $post_data['salesforce_update_mapped_user'], FILTER_VALIDATE_BOOLEAN ) ) {
                              $mapping_objects = $this->mappings->get_all_object_maps(
                                  array(
                  Severity: Minor
                  Found in classes/class-object-sync-sf-admin.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 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

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

                      public function process( WP_REST_Request $request ) {
                          // see methods: https://developer.wordpress.org/reference/classes/wp_rest_request/
                          // use error_log( 'request is ' . print_r( $request, true ) ); to log the request.
                          $http_method = $request->get_method();
                          $route       = $request->get_route();
                  Severity: Minor
                  Found in classes/class-object-sync-sf-rest.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 tabs has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function tabs( $tabs, $tab = '' ) {
                  
                          $get_data        = filter_input_array( INPUT_GET, FILTER_SANITIZE_SPECIAL_CHARS );
                          $consumer_key    = $this->login_credentials['consumer_key'];
                          $consumer_secret = $this->login_credentials['consumer_secret'];
                  Severity: Minor
                  Found in classes/class-object-sync-sf-admin.php - About 1 hr to fix

                    Method add_actions has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function add_actions() {
                    
                            // settings link.
                            add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 5 );
                    
                    
                    Severity: Minor
                    Found in classes/class-object-sync-sf-admin.php - About 1 hr to fix

                      Method check_for_action_scheduler has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function check_for_action_scheduler( $upgrader_object, $hook_extra ) {
                      
                              // skip if this action isn't this plugin being updated.
                              if ( 'plugin' !== $hook_extra['type'] && 'update' !== $hook_extra['action'] && $hook_extra['plugin'] !== $this->slug ) {
                                  return;
                      Severity: Minor
                      Found in classes/class-object-sync-sf-activate.php - About 1 hr to fix

                        Method restrict_logs_by_type has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function restrict_logs_by_type( $post_type ) {
                                $type     = 'wp_log';
                                $taxonomy = 'wp_log_type';
                                // only add filter to post type you want.
                                if ( 'wp_log' === $post_type ) {
                        Severity: Minor
                        Found in classes/class-object-sync-sf-logging.php - About 1 hr to fix

                          Method get_object_maps has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function get_object_maps( $conditions = array(), $reset = false ) {
                                  $table = $this->object_map_table;
                                  $order = ' ORDER BY object_updated, created';
                                  if ( ! empty( $conditions ) ) { // get multiple but with a limitation.
                                      $mappings = array();
                          Severity: Minor
                          Found in classes/class-object-sync-sf-mapping.php - About 1 hr to fix

                            Method request_token has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function request_token( $code ) {
                                    $data = array(
                                        'code'          => $code,
                                        'grant_type'    => 'authorization_code',
                                        'client_id'     => $this->consumer_key,
                            Severity: Minor
                            Found in classes/class-object-sync-sf-salesforce.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language