Passed
Pull Request — master (#195)
by Jonathan
02:56
created
classes/salesforce_query.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -22,27 +22,27 @@  discard block
 block discarded – undo
22 22
 	public $conditions = array();
23 23
 
24 24
 	/**
25
-	* Constructor which sets the query object type.
26
-	*
27
-	* @param string $object_type
28
-	*   Salesforce object type to query.
29
-	*/
25
+	 * Constructor which sets the query object type.
26
+	 *
27
+	 * @param string $object_type
28
+	 *   Salesforce object type to query.
29
+	 */
30 30
 	public function __construct( $object_type = '' ) {
31 31
 		$this->object_type = $object_type;
32 32
 	}
33 33
 
34 34
 	/**
35
-	* Add a condition to the query.
36
-	*
37
-	* @param string $field
38
-	*   Field name.
39
-	* @param mixed $value
40
-	*   Condition value. If an array, it will be split into quote enclosed
41
-	*   strings separated by commas inside of parenthesis. Note that the caller
42
-	*   must enclose the value in quotes as needed by the SF API.
43
-	* @param string $operator
44
-	*   Conditional operator. One of '=', '!=', '<', '>', 'LIKE, 'IN', 'NOT IN'.
45
-	*/
35
+	 * Add a condition to the query.
36
+	 *
37
+	 * @param string $field
38
+	 *   Field name.
39
+	 * @param mixed $value
40
+	 *   Condition value. If an array, it will be split into quote enclosed
41
+	 *   strings separated by commas inside of parenthesis. Note that the caller
42
+	 *   must enclose the value in quotes as needed by the SF API.
43
+	 * @param string $operator
44
+	 *   Conditional operator. One of '=', '!=', '<', '>', 'LIKE, 'IN', 'NOT IN'.
45
+	 */
46 46
 	public function add_condition( $field, $value, $operator = '=' ) {
47 47
 		if ( is_array( $value ) ) {
48 48
 			$value = "('" . implode( "','", $value ) . "')";
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 
62 62
 	/**
63
-	* Implements PHP's magic __toString().
64
-	*
65
-	* Function to convert the query to a string to pass to the SF API.
66
-	*
67
-	* @return string
68
-	*   SOQL query ready to be executed the SF API.
69
-	*/
63
+	 * Implements PHP's magic __toString().
64
+	 *
65
+	 * Function to convert the query to a string to pass to the SF API.
66
+	 *
67
+	 * @return string
68
+	 *   SOQL query ready to be executed the SF API.
69
+	 */
70 70
 	public function __toString() {
71 71
 
72 72
 		$query  = 'SELECT ';
Please login to merge, or discard this patch.
classes/admin-notice.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
 	protected $template;
22 22
 
23 23
 	/**
24
-	* Constructor which sets up the admin_notices hook for rendering
25
-	*
26
-	* @param mixed $condition
27
-	* @param string $message
28
-	* @param bool $dismissible
29
-	* @param string $type
30
-	* @param string $template
31
-	*
32
-	*/
24
+	 * Constructor which sets up the admin_notices hook for rendering
25
+	 *
26
+	 * @param mixed $condition
27
+	 * @param string $message
28
+	 * @param bool $dismissible
29
+	 * @param string $type
30
+	 * @param string $template
31
+	 *
32
+	 */
33 33
 	public function __construct( $condition, $message, $dismissible = false, $type = '', $template = '' ) {
34 34
 		$this->condition   = $condition;
35 35
 		$this->message     = $message;
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	}
43 43
 
44 44
 	/**
45
-	* Render an admin notice
46
-	*
47
-	*/
45
+	 * Render an admin notice
46
+	 *
47
+	 */
48 48
 	public function render() {
49 49
 
50 50
 		// class for the notice to use
Please login to merge, or discard this patch.
classes/salesforce_soap_partner.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 	public $wsdl;
23 23
 
24 24
 	/**
25
-	* Constructor which loads the SOAP client
26
-	*
27
-	*/
25
+	 * Constructor which loads the SOAP client
26
+	 *
27
+	 */
28 28
 	public function __construct( Object_Sync_Sf_Salesforce $sfapi, $wsdl = null ) {
29 29
 		if ( ! class_exists( 'SforceBaseClient' ) && file_exists( plugin_dir_path( __FILE__ ) . '../vendor/autoload.php' ) ) {
30 30
 			require_once plugin_dir_path( __FILE__ ) . '../vendor/developerforce/force.com-toolkit-for-php/soapclient/SforcePartnerClient.php';
Please login to merge, or discard this patch.
classes/activate.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 	private $installed_version;
22 22
 
23 23
 	/**
24
-	* Constructor which sets up activate hooks
25
-	*
26
-	* @param object $wpdb
27
-	* @param string $version
28
-	* @param string $slug
29
-	*
30
-	*/
24
+	 * Constructor which sets up activate hooks
25
+	 *
26
+	 * @param object $wpdb
27
+	 * @param string $version
28
+	 * @param string $slug
29
+	 *
30
+	 */
31 31
 	public function __construct( $wpdb, $version, $slug ) {
32 32
 		$this->wpdb    = $wpdb;
33 33
 		$this->version = $version;
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	}
40 40
 
41 41
 	/**
42
-	* Activation hooks
43
-	*/
42
+	 * Activation hooks
43
+	 */
44 44
 	private function add_actions() {
45 45
 
46 46
 		// on initial activation, run these hooks
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 
55 55
 	/**
56
-	* Check for the minimum required version of php
57
-	*/
56
+	 * Check for the minimum required version of php
57
+	 */
58 58
 	public function php_requirements() {
59 59
 		if ( version_compare( PHP_VERSION, '5.5', '<' ) ) {
60 60
 			deactivate_plugins( plugin_basename( __FILE__ ) );
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 
65 65
 	/**
66
-	* Create database tables for Salesforce
67
-	* This creates tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
68
-	*
69
-	*/
66
+	 * Create database tables for Salesforce
67
+	 * This creates tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
68
+	 *
69
+	 */
70 70
 	public function wordpress_salesforce_tables() {
71 71
 
72 72
 		$charset_collate = $this->wpdb->get_charset_collate();
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	/**
130
-	* Add roles and capabilities
131
-	* This adds the configure_salesforce capability to the admin role
132
-	*
133
-	* It also allows other plugins to add the capability to other roles
134
-	*
135
-	*/
130
+	 * Add roles and capabilities
131
+	 * This adds the configure_salesforce capability to the admin role
132
+	 *
133
+	 * It also allows other plugins to add the capability to other roles
134
+	 *
135
+	 */
136 136
 	public function add_roles_capabilities() {
137 137
 
138 138
 		// by default, only administrators can configure the plugin
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
 	}
154 154
 
155 155
 	/**
156
-	* Check for database version on plugin upgrade
157
-	* When the plugin is upgraded, if the database version does not match the current version, perform these methods
158
-	*
159
-	* @param object $upgrader_object
160
-	* @param array $hook_extra
161
-	*
162
-	* See https://developer.wordpress.org/reference/hooks/upgrader_process_complete/
163
-	*
164
-	*/
156
+	 * Check for database version on plugin upgrade
157
+	 * When the plugin is upgraded, if the database version does not match the current version, perform these methods
158
+	 *
159
+	 * @param object $upgrader_object
160
+	 * @param array $hook_extra
161
+	 *
162
+	 * See https://developer.wordpress.org/reference/hooks/upgrader_process_complete/
163
+	 *
164
+	 */
165 165
 	public function wordpress_salesforce_update_db_check( $upgrader_object, $hook_extra ) {
166 166
 		if ( get_site_option( 'object_sync_for_salesforce_db_version' ) !== $this->version ) {
167 167
 			$this->wordpress_salesforce_tables();
Please login to merge, or discard this patch.
classes/schedule.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 	protected $logging;
26 26
 
27 27
 	/**
28
-	* Constructor which sets up schedule and handler for when schedule runs
29
-	*
30
-	* @param object $wpdb
31
-	* @param string $version
32
-	* @param array $login_credentials
33
-	* @param string $slug
34
-	* @param object $wordpress
35
-	* @param object $salesforce
36
-	* @param object $mappings
37
-	* @param string $schedule_name
38
-	* @throws \Exception
39
-	*/
28
+	 * Constructor which sets up schedule and handler for when schedule runs
29
+	 *
30
+	 * @param object $wpdb
31
+	 * @param string $version
32
+	 * @param array $login_credentials
33
+	 * @param string $slug
34
+	 * @param object $wordpress
35
+	 * @param object $salesforce
36
+	 * @param object $mappings
37
+	 * @param string $schedule_name
38
+	 * @throws \Exception
39
+	 */
40 40
 
41 41
 	public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $schedule_name, $logging, $schedulable_classes ) {
42 42
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 
62 62
 	/**
63
-	* Create the actions to run
64
-	*
65
-	*/
63
+	 * Create the actions to run
64
+	 *
65
+	 */
66 66
 	public function add_actions() {
67 67
 
68 68
 		// create a recurring action for each schedulable item
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 	}
104 104
 
105 105
 	/**
106
-	* Convert the schedule frequency from the admin settings into an array
107
-	* interval must be in seconds for the class to use it
108
-	*
109
-	*/
106
+	 * Convert the schedule frequency from the admin settings into an array
107
+	 * interval must be in seconds for the class to use it
108
+	 *
109
+	 */
110 110
 	public function set_schedule_frequency( $schedules ) {
111 111
 
112 112
 		// create an option in the core schedules array for each one the plugin defines
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 
146 146
 	/**
147
-	* Convert the schedule frequency from the admin settings into an array
148
-	* interval must be in seconds for the class to use it
149
-	*
150
-	*/
147
+	 * Convert the schedule frequency from the admin settings into an array
148
+	 * interval must be in seconds for the class to use it
149
+	 *
150
+	 */
151 151
 	public function get_schedule_frequency_key( $name = '' ) {
152 152
 
153 153
 		$schedule_number = get_option( 'object_sync_for_salesforce_' . $name . '_schedule_number', '' );
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 	}
175 175
 
176 176
 	/**
177
-	* Convert the schedule frequency from the admin settings into seconds
178
-	*
179
-	*/
177
+	 * Convert the schedule frequency from the admin settings into seconds
178
+	 *
179
+	 */
180 180
 	public function get_schedule_frequency_seconds( $name = '' ) {
181 181
 
182 182
 		$schedule_number = get_option( 'object_sync_for_salesforce_' . $name . '_schedule_number', '' );
Please login to merge, or discard this patch.
classes/deactivate.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	protected $schedulable_classes;
21 21
 
22 22
 	/**
23
-	* Constructor which sets up deactivate hooks
24
-	* @param object $wpdb
25
-	* @param string $version
26
-	* @param string $slug
27
-	* @param array $schedulable_classes
28
-	*
29
-	*/
23
+	 * Constructor which sets up deactivate hooks
24
+	 * @param object $wpdb
25
+	 * @param string $version
26
+	 * @param string $slug
27
+	 * @param array $schedulable_classes
28
+	 *
29
+	 */
30 30
 	public function __construct( $wpdb, $version, $slug, $schedulable_classes ) {
31 31
 		$this->wpdb                = $wpdb;
32 32
 		$this->version             = $version;
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	/**
48
-	* Drop database tables for Salesforce
49
-	* This removes the tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
50
-	*
51
-	*/
48
+	 * Drop database tables for Salesforce
49
+	 * This removes the tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
50
+	 *
51
+	 */
52 52
 	public function wordpress_salesforce_drop_tables() {
53 53
 		$field_map_table  = $this->wpdb->prefix . 'object_sync_sf_field_map';
54 54
 		$object_map_table = $this->wpdb->prefix . 'object_sync_sf_object_map';
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 	}
59 59
 
60 60
 	/**
61
-	* Clear the scheduled tasks
62
-	* This removes all the scheduled tasks that are included in the plugin's $schedulable_classes array
61
+	 * Clear the scheduled tasks
62
+	 * This removes all the scheduled tasks that are included in the plugin's $schedulable_classes array
63 63
 	// todo: fix this so it uses action scheduler's scheduled tasks instead
64
-	*
65
-	*/
64
+	 *
65
+	 */
66 66
 	public function clear_schedule() {
67 67
 		foreach ( $this->schedulable_classes as $key => $value ) {
68 68
 			wp_clear_scheduled_hook( $key );
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
 	}
71 71
 
72 72
 	/**
73
-	* Delete the log post type
74
-	* This removes the log post type
75
-	*
76
-	*/
73
+	 * Delete the log post type
74
+	 * This removes the log post type
75
+	 *
76
+	 */
77 77
 	public function delete_log_post_type() {
78 78
 		unregister_post_type( 'wp_log' );
79 79
 	}
80 80
 
81 81
 	/**
82
-	* Remove roles and capabilities
83
-	* This removes the configure_salesforce capability from the admin role
84
-	*
85
-	* It also allows other plugins to remove the capability from other roles
86
-	*
87
-	*/
82
+	 * Remove roles and capabilities
83
+	 * This removes the configure_salesforce capability from the admin role
84
+	 *
85
+	 * It also allows other plugins to remove the capability from other roles
86
+	 *
87
+	 */
88 88
 	public function remove_roles_capabilities() {
89 89
 
90 90
 		// by default, only administrators can configure the plugin
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
 	}
105 105
 
106 106
 	/**
107
-	* Flush the plugin cache
108
-	*
109
-	*/
107
+	 * Flush the plugin cache
108
+	 *
109
+	 */
110 110
 	public function flush_plugin_cache() {
111 111
 		$sfwp_transients = new Object_Sync_Sf_WordPress_Transient( 'sfwp_transients' );
112 112
 		$sfwp_transients->flush();
113 113
 	}
114 114
 
115 115
 	/**
116
-	* Clear the plugin options
117
-	*
118
-	*/
116
+	 * Clear the plugin options
117
+	 *
118
+	 */
119 119
 	public function delete_plugin_options() {
120 120
 		$table          = $this->wpdb->prefix . 'options';
121 121
 		$plugin_options = $this->wpdb->get_results( 'SELECT option_name FROM ' . $table . ' WHERE option_name LIKE "object_sync_for_salesforce_%"', ARRAY_A );
Please login to merge, or discard this patch.
classes/salesforce_push.php 1 patch
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -26,26 +26,26 @@  discard block
 block discarded – undo
26 26
 	protected $queue;
27 27
 
28 28
 	/**
29
-	* @var string
30
-	*/
29
+	 * @var string
30
+	 */
31 31
 	public $schedule_name; // allow for naming the queue in case there are multiple queues
32 32
 
33 33
 	/**
34
-	* Constructor which sets up push schedule
35
-	*
36
-	* @param object $wpdb
37
-	* @param string $version
38
-	* @param array $login_credentials
39
-	* @param string $slug
40
-	* @param string $option_prefix
41
-	* @param object $wordpress
42
-	* @param object $salesforce
43
-	* @param object $mappings
44
-	* @param object $logging
45
-	* @param array $schedulable_classes
46
-	* @param object $queue
47
-	* @throws \Object_Sync_Sf_Exception
48
-	*/
34
+	 * Constructor which sets up push schedule
35
+	 *
36
+	 * @param object $wpdb
37
+	 * @param string $version
38
+	 * @param array $login_credentials
39
+	 * @param string $slug
40
+	 * @param string $option_prefix
41
+	 * @param object $wordpress
42
+	 * @param object $salesforce
43
+	 * @param object $mappings
44
+	 * @param object $logging
45
+	 * @param array $schedulable_classes
46
+	 * @param object $queue
47
+	 * @throws \Object_Sync_Sf_Exception
48
+	 */
49 49
 	public function __construct( $wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes, $queue ) {
50 50
 		$this->wpdb                = $wpdb;
51 51
 		$this->version             = $version;
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 	}
70 70
 
71 71
 	/**
72
-	* Create the action hooks based on what object maps exist from the admin settings.
73
-	* We do not have any actions for blogroll at this time.
74
-	*
75
-	*/
72
+	 * Create the action hooks based on what object maps exist from the admin settings.
73
+	 * We do not have any actions for blogroll at this time.
74
+	 *
75
+	 */
76 76
 	public function add_actions() {
77 77
 		$db_version = get_option( $this->option_prefix . 'db_version', false );
78 78
 		if ( $db_version === $this->version ) {
@@ -113,63 +113,63 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 
115 115
 	/**
116
-	* Method for ajax hooks to call for pushing manually
117
-	*
118
-	* @param array $object
119
-	* @param string $type
120
-	*
121
-	*/
116
+	 * Method for ajax hooks to call for pushing manually
117
+	 *
118
+	 * @param array $object
119
+	 * @param string $type
120
+	 *
121
+	 */
122 122
 	public function manual_object_update( $object, $type ) {
123 123
 		$this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_update, true );
124 124
 	}
125 125
 
126 126
 	/**
127
-	* Callback method for adding a user
128
-	*
129
-	* @param string $user_id
130
-	*/
127
+	 * Callback method for adding a user
128
+	 *
129
+	 * @param string $user_id
130
+	 */
131 131
 	public function add_user( $user_id ) {
132 132
 		$user = $this->wordpress->get_wordpress_object_data( 'user', $user_id );
133 133
 		$this->object_insert( $user, 'user' );
134 134
 	}
135 135
 
136 136
 	/**
137
-	* Callback method for adding a user via the Ultimate Member plugin
138
-	*
139
-	* @param string $user_id
140
-	*/
137
+	 * Callback method for adding a user via the Ultimate Member plugin
138
+	 *
139
+	 * @param string $user_id
140
+	 */
141 141
 	public function um_add_user( $user_id, $form_data = array() ) {
142 142
 		$this->object_insert( $form_data, 'user' );
143 143
 	}
144 144
 
145 145
 	/**
146
-	* Callback method for editing a user
147
-	*
148
-	* @param string $user_id
149
-	* @param object $old_user_data
150
-	*/
146
+	 * Callback method for editing a user
147
+	 *
148
+	 * @param string $user_id
149
+	 * @param object $old_user_data
150
+	 */
151 151
 	public function edit_user( $user_id, $old_user_data ) {
152 152
 		$user = $this->wordpress->get_wordpress_object_data( 'user', $user_id );
153 153
 		$this->object_update( $user, 'user' );
154 154
 	}
155 155
 
156 156
 	/**
157
-	* Callback method for deleting a user
158
-	*
159
-	* @param string $user_id
160
-	*/
157
+	 * Callback method for deleting a user
158
+	 *
159
+	 * @param string $user_id
160
+	 */
161 161
 	public function delete_user( $user_id ) {
162 162
 		$user = $this->wordpress->get_wordpress_object_data( 'user', $user_id );
163 163
 		$this->object_delete( $user, 'user' );
164 164
 	}
165 165
 
166 166
 	/**
167
-	* Callback method for posts of any type
168
-	* This can handle create, update, and delete actions
169
-	*
170
-	* @param string $post_id
171
-	* @param object $post
172
-	*/
167
+	 * Callback method for posts of any type
168
+	 * This can handle create, update, and delete actions
169
+	 *
170
+	 * @param string $post_id
171
+	 * @param object $post
172
+	 */
173 173
 	public function post_actions( $post_id, $post ) {
174 174
 
175 175
 		$post_type = $post->post_type;
@@ -216,66 +216,66 @@  discard block
 block discarded – undo
216 216
 	}
217 217
 
218 218
 	/**
219
-	* Callback method for adding an attachment
220
-	*
221
-	* @param string $post_id
222
-	*/
219
+	 * Callback method for adding an attachment
220
+	 *
221
+	 * @param string $post_id
222
+	 */
223 223
 	public function add_attachment( $post_id ) {
224 224
 		$attachment = $this->wordpress->get_wordpress_object_data( 'attachment', $post_id );
225 225
 		$this->object_insert( $attachment, 'attachment' );
226 226
 	}
227 227
 
228 228
 	/**
229
-	* Callback method for editing an attachment
230
-	*
231
-	* @param string $post_id
232
-	*/
229
+	 * Callback method for editing an attachment
230
+	 *
231
+	 * @param string $post_id
232
+	 */
233 233
 	public function edit_attachment( $post_id ) {
234 234
 		$attachment = $this->wordpress->get_wordpress_object_data( 'attachment', $post_id );
235 235
 		$this->object_update( $attachment, 'attachment' );
236 236
 	}
237 237
 
238 238
 	/**
239
-	* Callback method for editing an attachment
240
-	*
241
-	* @param string $post_id
242
-	*/
239
+	 * Callback method for editing an attachment
240
+	 *
241
+	 * @param string $post_id
242
+	 */
243 243
 	public function delete_attachment( $post_id ) {
244 244
 		$attachment = $this->wordpress->get_wordpress_object_data( 'attachment', $post_id );
245 245
 		$this->object_delete( $attachment, 'attachment' );
246 246
 	}
247 247
 
248 248
 	/**
249
-	* Callback method for adding a term
250
-	*
251
-	* @param string $term_id
252
-	* @param string $tt_id
253
-	* @param string $taxonomy
254
-	*/
249
+	 * Callback method for adding a term
250
+	 *
251
+	 * @param string $term_id
252
+	 * @param string $tt_id
253
+	 * @param string $taxonomy
254
+	 */
255 255
 	public function add_term( $term_id, $tt_id, $taxonomy ) {
256 256
 		$term = $this->wordpress->get_wordpress_object_data( $taxonomy, $term_id );
257 257
 		$this->object_insert( $term, $taxonomy );
258 258
 	}
259 259
 
260 260
 	/**
261
-	* Callback method for editing a term
262
-	*
263
-	* @param string $term_id
264
-	* @param string $taxonomy
265
-	*/
261
+	 * Callback method for editing a term
262
+	 *
263
+	 * @param string $term_id
264
+	 * @param string $taxonomy
265
+	 */
266 266
 	public function edit_term( $term_id, $taxonomy ) {
267 267
 		$term = $this->wordpress->get_wordpress_object_data( $taxonomy, $term_id );
268 268
 		$this->object_update( $term, $taxonomy );
269 269
 	}
270 270
 
271 271
 	/**
272
-	* Callback method for deleting a term
273
-	*
274
-	* @param int $term (id)
275
-	* @param int $term_taxonomy_id
276
-	* @param string $taxonomy (slug)
277
-	* @param object $deleted_term
278
-	*/
272
+	 * Callback method for deleting a term
273
+	 *
274
+	 * @param int $term (id)
275
+	 * @param int $term_taxonomy_id
276
+	 * @param string $taxonomy (slug)
277
+	 * @param object $deleted_term
278
+	 */
279 279
 	public function delete_term( $term, $tt_id, $taxonomy, $deleted_term ) {
280 280
 		$deleted_term = (array) $deleted_term;
281 281
 		$type         = $deleted_term['taxonomy'];
@@ -283,75 +283,75 @@  discard block
 block discarded – undo
283 283
 	}
284 284
 
285 285
 	/**
286
-	* Callback method for adding a comment
287
-	*
288
-	* @param string $comment_id
289
-	* @param int|string comment_approved
290
-	* @param array $commentdata
291
-	*/
286
+	 * Callback method for adding a comment
287
+	 *
288
+	 * @param string $comment_id
289
+	 * @param int|string comment_approved
290
+	 * @param array $commentdata
291
+	 */
292 292
 	public function add_comment( $comment_id, $comment_approved, $commentdata = array() ) {
293 293
 		$comment = $this->wordpress->get_wordpress_object_data( 'comment', $comment_id );
294 294
 		$this->object_insert( $comment, 'comment' );
295 295
 	}
296 296
 
297 297
 	/**
298
-	* Callback method for editing a comment
299
-	*
300
-	* @param string $comment_id
301
-	*/
298
+	 * Callback method for editing a comment
299
+	 *
300
+	 * @param string $comment_id
301
+	 */
302 302
 	public function edit_comment( $comment_id ) {
303 303
 		$comment = $this->wordpress->get_wordpress_object_data( 'comment', $comment_id );
304 304
 		$this->object_update( $comment, 'comment' );
305 305
 	}
306 306
 
307 307
 	/**
308
-	* Callback method for deleting a comment
309
-	*
310
-	* @param string $comment_id
311
-	*/
308
+	 * Callback method for deleting a comment
309
+	 *
310
+	 * @param string $comment_id
311
+	 */
312 312
 	public function delete_comment( $comment_id ) {
313 313
 		$comment = $this->wordpress->get_wordpress_object_data( 'comment', $comment_id );
314 314
 		$this->object_delete( $comment, 'comment' );
315 315
 	}
316 316
 
317 317
 	/**
318
-	* Insert a new object
319
-	* This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
320
-	*/
318
+	 * Insert a new object
319
+	 * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
320
+	 */
321 321
 	private function object_insert( $object, $type ) {
322 322
 		$this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_create );
323 323
 	}
324 324
 
325 325
 	/**
326
-	* Update an existing object
327
-	* This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
328
-	*/
326
+	 * Update an existing object
327
+	 * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
328
+	 */
329 329
 	private function object_update( $object, $type ) {
330 330
 		$this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_update );
331 331
 	}
332 332
 
333 333
 	/**
334
-	* Delete an existing object
335
-	* This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
336
-	*/
334
+	 * Delete an existing object
335
+	 * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
336
+	 */
337 337
 	private function object_delete( $object, $type ) {
338 338
 		$this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_delete );
339 339
 	}
340 340
 
341 341
 	/**
342
-	* Push objects to Salesforce.
343
-	* This method decides whether to do the processing immediately or queue it to the schedule class (or skip it based on another plugin's activity)
344
-	*
345
-	* @param string $object_type
346
-	*   Type of WordPress object.
347
-	* @param array $object
348
-	*   The WordPress data that needs to be sent to Salesforce.
349
-	* @param int $sf_sync_trigger
350
-	*   The trigger being responded to.
351
-	* @param bool $manual
352
-	*   Are we calling this manually?
353
-	*
354
-	*/
342
+	 * Push objects to Salesforce.
343
+	 * This method decides whether to do the processing immediately or queue it to the schedule class (or skip it based on another plugin's activity)
344
+	 *
345
+	 * @param string $object_type
346
+	 *   Type of WordPress object.
347
+	 * @param array $object
348
+	 *   The WordPress data that needs to be sent to Salesforce.
349
+	 * @param int $sf_sync_trigger
350
+	 *   The trigger being responded to.
351
+	 * @param bool $manual
352
+	 *   Are we calling this manually?
353
+	 *
354
+	 */
355 355
 	private function salesforce_push_object_crud( $object_type, $object, $sf_sync_trigger, $manual = false ) {
356 356
 
357 357
 		$structure       = $this->wordpress->get_wordpress_table_structure( $object_type );
@@ -475,20 +475,20 @@  discard block
 block discarded – undo
475 475
 	}
476 476
 
477 477
 	/**
478
-	* Sync WordPress objects and Salesforce objects using the REST API.
479
-	*
480
-	* @param string $object_type
481
-	*   Type of WordPress object.
482
-	* @param array|int $object|$object_id
483
-	*   The WordPress object data or its ID.
484
-	* @param array $mapping|$mapping_id
485
-	*   Salesforce field mapping data array or ID.
486
-	* @param int $sf_sync_trigger
487
-	*   Trigger for this sync.
488
-	*
489
-	* @return true or exit the method
490
-	*
491
-	*/
478
+	 * Sync WordPress objects and Salesforce objects using the REST API.
479
+	 *
480
+	 * @param string $object_type
481
+	 *   Type of WordPress object.
482
+	 * @param array|int $object|$object_id
483
+	 *   The WordPress object data or its ID.
484
+	 * @param array $mapping|$mapping_id
485
+	 *   Salesforce field mapping data array or ID.
486
+	 * @param int $sf_sync_trigger
487
+	 *   Trigger for this sync.
488
+	 *
489
+	 * @return true or exit the method
490
+	 *
491
+	 */
492 492
 	public function salesforce_push_sync_rest( $object_type, $object, $mapping, $sf_sync_trigger ) {
493 493
 
494 494
 		if ( is_int( $object ) ) {
@@ -1041,21 +1041,21 @@  discard block
 block discarded – undo
1041 1041
 	}
1042 1042
 
1043 1043
 	/**
1044
-	* Create an object map between a WordPress object and a Salesforce object
1045
-	*
1046
-	* @param array $wordpress_object
1047
-	*   Array of the WordPress object's data
1048
-	* @param string $id_field_name
1049
-	*   How this object names its primary field. ie Id or comment_id or whatever
1050
-	* @param string $salesforce_id
1051
-	*   Unique identifier for the Salesforce object
1052
-	* @param array $field_mapping
1053
-	*   The row that maps the object types together, including which fields match which other fields
1054
-	*
1055
-	* @return int $wpdb->insert_id
1056
-	*   This is the database row for the map object
1057
-	*
1058
-	*/
1044
+	 * Create an object map between a WordPress object and a Salesforce object
1045
+	 *
1046
+	 * @param array $wordpress_object
1047
+	 *   Array of the WordPress object's data
1048
+	 * @param string $id_field_name
1049
+	 *   How this object names its primary field. ie Id or comment_id or whatever
1050
+	 * @param string $salesforce_id
1051
+	 *   Unique identifier for the Salesforce object
1052
+	 * @param array $field_mapping
1053
+	 *   The row that maps the object types together, including which fields match which other fields
1054
+	 *
1055
+	 * @return int $wpdb->insert_id
1056
+	 *   This is the database row for the map object
1057
+	 *
1058
+	 */
1059 1059
 	private function create_object_map( $wordpress_object, $id_field_name, $salesforce_id, $field_mapping, $pending = false ) {
1060 1060
 
1061 1061
 		if ( true === $pending ) {
Please login to merge, or discard this patch.
classes/salesforce.php 1 patch
Indentation   +408 added lines, -408 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
 	public $response;
18 18
 
19 19
 	/**
20
-	* Constructor which initializes the Salesforce APIs.
21
-	*
22
-	* @param string $consumer_key
23
-	*   Salesforce key to connect to your Salesforce instance.
24
-	* @param string $consumer_secret
25
-	*   Salesforce secret to connect to your Salesforce instance.
26
-	* @param string $login_url
27
-	*   Login URL for Salesforce auth requests - differs for production and sandbox
28
-	* @param string $callback_url
29
-	*   WordPress URL where Salesforce should send you after authentication
30
-	* @param string $authorize_path
31
-	*   Oauth path that Salesforce wants
32
-	* @param string $token_path
33
-	*   Path Salesforce uses to give you a token
34
-	* @param string $rest_api_version
35
-	*   What version of the Salesforce REST API to use
36
-	* @param object $wordpress
37
-	*   Object for doing things to WordPress - retrieving data, cache, etc.
38
-	* @param string $slug
39
-	*   Slug for this plugin. Can be used for file including, especially
40
-	* @param string $option_prefix
41
-	*   Option prefix for this plugin. Used for getting and setting options, actions, etc.
42
-	* @param object $logging
43
-	*   Logging object for this plugin.
44
-	* @param array $schedulable_classes
45
-	*   array of classes that can have scheduled tasks specific to them
46
-	*/
20
+	 * Constructor which initializes the Salesforce APIs.
21
+	 *
22
+	 * @param string $consumer_key
23
+	 *   Salesforce key to connect to your Salesforce instance.
24
+	 * @param string $consumer_secret
25
+	 *   Salesforce secret to connect to your Salesforce instance.
26
+	 * @param string $login_url
27
+	 *   Login URL for Salesforce auth requests - differs for production and sandbox
28
+	 * @param string $callback_url
29
+	 *   WordPress URL where Salesforce should send you after authentication
30
+	 * @param string $authorize_path
31
+	 *   Oauth path that Salesforce wants
32
+	 * @param string $token_path
33
+	 *   Path Salesforce uses to give you a token
34
+	 * @param string $rest_api_version
35
+	 *   What version of the Salesforce REST API to use
36
+	 * @param object $wordpress
37
+	 *   Object for doing things to WordPress - retrieving data, cache, etc.
38
+	 * @param string $slug
39
+	 *   Slug for this plugin. Can be used for file including, especially
40
+	 * @param string $option_prefix
41
+	 *   Option prefix for this plugin. Used for getting and setting options, actions, etc.
42
+	 * @param object $logging
43
+	 *   Logging object for this plugin.
44
+	 * @param array $schedulable_classes
45
+	 *   array of classes that can have scheduled tasks specific to them
46
+	 */
47 47
 	public function __construct( $consumer_key, $consumer_secret, $login_url, $callback_url, $authorize_path, $token_path, $rest_api_version, $wordpress, $slug, $option_prefix, $logging, $schedulable_classes ) {
48 48
 		$this->consumer_key        = $consumer_key;
49 49
 		$this->consumer_secret     = $consumer_secret;
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 	}
74 74
 
75 75
 	/**
76
-	* Converts a 15-character case-sensitive Salesforce ID to 18-character
77
-	* case-insensitive ID. If input is not 15-characters, return input unaltered.
78
-	*
79
-	* @param string $sf_id_15
80
-	*   15-character case-sensitive Salesforce ID
81
-	* @return string
82
-	*   18-character case-insensitive Salesforce ID
83
-	*/
76
+	 * Converts a 15-character case-sensitive Salesforce ID to 18-character
77
+	 * case-insensitive ID. If input is not 15-characters, return input unaltered.
78
+	 *
79
+	 * @param string $sf_id_15
80
+	 *   15-character case-sensitive Salesforce ID
81
+	 * @return string
82
+	 *   18-character case-insensitive Salesforce ID
83
+	 */
84 84
 	public static function convert_id( $sf_id_15 ) {
85 85
 		if ( strlen( $sf_id_15 ) !== 15 ) {
86 86
 			return $sf_id_15;
@@ -100,17 +100,17 @@  discard block
 block discarded – undo
100 100
 	}
101 101
 
102 102
 	/**
103
-	* Given a Salesforce ID, return the corresponding SObject name. (Based on
104
-	*  keyPrefix from object definition, @see
105
-	*  https://developer.salesforce.com/forums/?id=906F0000000901ZIAQ )
106
-	*
107
-	* @param string $sf_id
108
-	*   15- or 18-character Salesforce ID
109
-	* @return string
110
-	*   sObject name, e.g. "Account", "Contact", "my__Custom_Object__c" or FALSE
111
-	*   if no match could be found.
112
-	* @throws Object_Sync_Sf_Exception
113
-	*/
103
+	 * Given a Salesforce ID, return the corresponding SObject name. (Based on
104
+	 *  keyPrefix from object definition, @see
105
+	 *  https://developer.salesforce.com/forums/?id=906F0000000901ZIAQ )
106
+	 *
107
+	 * @param string $sf_id
108
+	 *   15- or 18-character Salesforce ID
109
+	 * @return string
110
+	 *   sObject name, e.g. "Account", "Contact", "my__Custom_Object__c" or FALSE
111
+	 *   if no match could be found.
112
+	 * @throws Object_Sync_Sf_Exception
113
+	 */
114 114
 	public function get_sobject_type( $sf_id ) {
115 115
 		$objects = $this->objects(
116 116
 			array(
@@ -127,17 +127,17 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	/**
130
-	* Determine if this SF instance is fully configured.
131
-	*
132
-	*/
130
+	 * Determine if this SF instance is fully configured.
131
+	 *
132
+	 */
133 133
 	public function is_authorized() {
134 134
 		return ! empty( $this->consumer_key ) && ! empty( $this->consumer_secret ) && $this->get_refresh_token();
135 135
 	}
136 136
 
137 137
 	/**
138
-	* Get REST API versions available on this Salesforce organization
139
-	* This is not an authenticated call, so it would not be a helpful test
140
-	*/
138
+	 * Get REST API versions available on this Salesforce organization
139
+	 * This is not an authenticated call, so it would not be a helpful test
140
+	 */
141 141
 	public function get_api_versions() {
142 142
 		$options = array(
143 143
 			'authenticated' => false,
@@ -147,26 +147,26 @@  discard block
 block discarded – undo
147 147
 	}
148 148
 
149 149
 	/**
150
-	* Make a call to the Salesforce REST API.
151
-	*
152
-	* @param string $path
153
-	*   Path to resource.
154
-	* @param array $params
155
-	*   Parameters to provide.
156
-	* @param string $method
157
-	*   Method to initiate the call, such as GET or POST. Defaults to GET.
158
-	* @param array $options
159
-	*   Any method can supply options for the API call, and they'll be preserved as far as the curl request
160
-	*   They get merged with the class options
161
-	* @param string $type
162
-	*   Type of call. Defaults to 'rest' - currently we don't support other types.
163
-	*   Other exammple in Drupal is 'apexrest'
164
-	*
165
-	* @return mixed
166
-	*   The requested response.
167
-	*
168
-	* @throws Object_Sync_Sf_Exception
169
-	*/
150
+	 * Make a call to the Salesforce REST API.
151
+	 *
152
+	 * @param string $path
153
+	 *   Path to resource.
154
+	 * @param array $params
155
+	 *   Parameters to provide.
156
+	 * @param string $method
157
+	 *   Method to initiate the call, such as GET or POST. Defaults to GET.
158
+	 * @param array $options
159
+	 *   Any method can supply options for the API call, and they'll be preserved as far as the curl request
160
+	 *   They get merged with the class options
161
+	 * @param string $type
162
+	 *   Type of call. Defaults to 'rest' - currently we don't support other types.
163
+	 *   Other exammple in Drupal is 'apexrest'
164
+	 *
165
+	 * @return mixed
166
+	 *   The requested response.
167
+	 *
168
+	 * @throws Object_Sync_Sf_Exception
169
+	 */
170 170
 	public function api_call( $path, $params = array(), $method = 'GET', $options = array(), $type = 'rest' ) {
171 171
 		if ( ! $this->get_access_token() ) {
172 172
 			$this->refresh_token();
@@ -217,25 +217,25 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
 	/**
220
-	* Private helper to issue an SF API request.
221
-	* This method is the only place where we read to or write from the cache
222
-	*
223
-	* @param string $path
224
-	*   Path to resource.
225
-	* @param array $params
226
-	*   Parameters to provide.
227
-	* @param string $method
228
-	*   Method to initiate the call, such as GET or POST.  Defaults to GET.
229
-	* @param array $options
230
-	*   This is the options array from the api_call method
231
-	*   This is where it gets merged with $this->options
232
-	* @param string $type
233
-	*   Type of call. Defaults to 'rest' - currently we don't support other types
234
-	*   Other exammple in Drupal is 'apexrest'
235
-	*
236
-	* @return array
237
-	*   The requested data.
238
-	*/
220
+	 * Private helper to issue an SF API request.
221
+	 * This method is the only place where we read to or write from the cache
222
+	 *
223
+	 * @param string $path
224
+	 *   Path to resource.
225
+	 * @param array $params
226
+	 *   Parameters to provide.
227
+	 * @param string $method
228
+	 *   Method to initiate the call, such as GET or POST.  Defaults to GET.
229
+	 * @param array $options
230
+	 *   This is the options array from the api_call method
231
+	 *   This is where it gets merged with $this->options
232
+	 * @param string $type
233
+	 *   Type of call. Defaults to 'rest' - currently we don't support other types
234
+	 *   Other exammple in Drupal is 'apexrest'
235
+	 *
236
+	 * @return array
237
+	 *   The requested data.
238
+	 */
239 239
 	protected function api_http_request( $path, $params, $method, $options = array(), $type = 'rest' ) {
240 240
 		$options = array_merge( $this->options, $options ); // this will override a value in $this->options with the one in $options if there is a matching key
241 241
 		$url     = $this->get_api_endpoint( $type ) . $path;
@@ -313,22 +313,22 @@  discard block
 block discarded – undo
313 313
 	}
314 314
 
315 315
 	/**
316
-	* Make the HTTP request. Wrapper around curl().
317
-	*
318
-	* @param string $url
319
-	*   Path to make request from.
320
-	* @param array $data
321
-	*   The request body.
322
-	* @param array $headers
323
-	*   Request headers to send as name => value.
324
-	* @param string $method
325
-	*   Method to initiate the call, such as GET or POST. Defaults to GET.
326
-	* @param array $options
327
-	*   This is the options array from the api_http_request method
328
-	*
329
-	* @return array
330
-	*   Salesforce response object.
331
-	*/
316
+	 * Make the HTTP request. Wrapper around curl().
317
+	 *
318
+	 * @param string $url
319
+	 *   Path to make request from.
320
+	 * @param array $data
321
+	 *   The request body.
322
+	 * @param array $headers
323
+	 *   Request headers to send as name => value.
324
+	 * @param string $method
325
+	 *   Method to initiate the call, such as GET or POST. Defaults to GET.
326
+	 * @param array $options
327
+	 *   This is the options array from the api_http_request method
328
+	 *
329
+	 * @return array
330
+	 *   Salesforce response object.
331
+	 */
332 332
 	protected function http_request( $url, $data, $headers = array(), $method = 'GET', $options = array() ) {
333 333
 		// Build the request, including path and headers. Internal use.
334 334
 
@@ -463,14 +463,14 @@  discard block
 block discarded – undo
463 463
 	}
464 464
 
465 465
 	/**
466
-	* Get the API end point for a given type of the API.
467
-	*
468
-	* @param string $api_type
469
-	*   E.g., rest, partner, enterprise.
470
-	*
471
-	* @return string
472
-	*   Complete URL endpoint for API access.
473
-	*/
466
+	 * Get the API end point for a given type of the API.
467
+	 *
468
+	 * @param string $api_type
469
+	 *   E.g., rest, partner, enterprise.
470
+	 *
471
+	 * @return string
472
+	 *   Complete URL endpoint for API access.
473
+	 */
474 474
 	public function get_api_endpoint( $api_type = 'rest' ) {
475 475
 		// Special handling for apexrest, since it's not in the identity object.
476 476
 		if ( 'apexrest' === $api_type ) {
@@ -486,67 +486,67 @@  discard block
 block discarded – undo
486 486
 	}
487 487
 
488 488
 	/**
489
-	* Get the SF instance URL. Useful for linking to objects.
490
-	*/
489
+	 * Get the SF instance URL. Useful for linking to objects.
490
+	 */
491 491
 	public function get_instance_url() {
492 492
 		return get_option( $this->option_prefix . 'instance_url', '' );
493 493
 	}
494 494
 
495 495
 	/**
496
-	* Set the SF instanc URL.
497
-	*
498
-	* @param string $url
499
-	*   URL to set.
500
-	*/
496
+	 * Set the SF instanc URL.
497
+	 *
498
+	 * @param string $url
499
+	 *   URL to set.
500
+	 */
501 501
 	protected function set_instance_url( $url ) {
502 502
 		update_option( $this->option_prefix . 'instance_url', $url );
503 503
 	}
504 504
 
505 505
 	/**
506
-	* Get the access token.
507
-	*/
506
+	 * Get the access token.
507
+	 */
508 508
 	public function get_access_token() {
509 509
 		return get_option( $this->option_prefix . 'access_token', '' );
510 510
 	}
511 511
 
512 512
 	/**
513
-	* Set the access token.
514
-	*
515
-	* It is stored in session.
516
-	*
517
-	* @param string $token
518
-	*   Access token from Salesforce.
519
-	*/
513
+	 * Set the access token.
514
+	 *
515
+	 * It is stored in session.
516
+	 *
517
+	 * @param string $token
518
+	 *   Access token from Salesforce.
519
+	 */
520 520
 	protected function set_access_token( $token ) {
521 521
 		update_option( $this->option_prefix . 'access_token', $token );
522 522
 	}
523 523
 
524 524
 	/**
525
-	* Get refresh token.
526
-	*/
525
+	 * Get refresh token.
526
+	 */
527 527
 	protected function get_refresh_token() {
528 528
 		return get_option( $this->option_prefix . 'refresh_token', '' );
529 529
 	}
530 530
 
531 531
 	/**
532
-	* Set refresh token.
533
-	*
534
-	* @param string $token
535
-	*   Refresh token from Salesforce.
536
-	*/
532
+	 * Set refresh token.
533
+	 *
534
+	 * @param string $token
535
+	 *   Refresh token from Salesforce.
536
+	 */
537 537
 	protected function set_refresh_token( $token ) {
538 538
 		update_option( $this->option_prefix . 'refresh_token', $token );
539 539
 	}
540 540
 
541 541
 	/**
542
-	* Refresh access token based on the refresh token. Updates session variable.
543
-	*
544
-	* todo: figure out how to do this as part of the schedule class
545
-	* this is a scheduleable class and so we could add a method from this class to run every 24 hours, but it's unclear to me that we need it. salesforce seems to refresh itself as it needs to.
546
-	* but it could be a performance boost to do it at scheduleable intervals instead.
547
-	*
548
-	* @throws Object_Sync_Sf_Exception
549
-	*/
542
+	 * Refresh access token based on the refresh token. Updates session variable.
543
+	 *
544
+	 * todo: figure out how to do this as part of the schedule class
545
+	 * this is a scheduleable class and so we could add a method from this class to run every 24 hours, but it's unclear to me that we need it. salesforce seems to refresh itself as it needs to.
546
+	 * but it could be a performance boost to do it at scheduleable intervals instead.
547
+	 *
548
+	 * @throws Object_Sync_Sf_Exception
549
+	 */
550 550
 	protected function refresh_token() {
551 551
 		$refresh_token = $this->get_refresh_token();
552 552
 		if ( empty( $refresh_token ) ) {
@@ -593,13 +593,13 @@  discard block
 block discarded – undo
593 593
 	}
594 594
 
595 595
 	/**
596
-	* Retrieve and store the Salesforce identity given an ID url.
597
-	*
598
-	* @param string $id
599
-	*   Identity URL.
600
-	*
601
-	* @throws Object_Sync_Sf_Exception
602
-	*/
596
+	 * Retrieve and store the Salesforce identity given an ID url.
597
+	 *
598
+	 * @param string $id
599
+	 *   Identity URL.
600
+	 *
601
+	 * @throws Object_Sync_Sf_Exception
602
+	 */
603 603
 	protected function set_identity( $id ) {
604 604
 		$headers  = array(
605 605
 			'Authorization'   => 'Authorization: OAuth ' . $this->get_access_token(),
@@ -615,18 +615,18 @@  discard block
 block discarded – undo
615 615
 	}
616 616
 
617 617
 	/**
618
-	* Return the Salesforce identity, which is stored in a variable.
619
-	*
620
-	* @return array
621
-	*   Returns FALSE if no identity has been stored.
622
-	*/
618
+	 * Return the Salesforce identity, which is stored in a variable.
619
+	 *
620
+	 * @return array
621
+	 *   Returns FALSE if no identity has been stored.
622
+	 */
623 623
 	public function get_identity() {
624 624
 		return get_option( $this->option_prefix . 'identity', false );
625 625
 	}
626 626
 
627 627
 	/**
628
-	* OAuth step 1: Redirect to Salesforce and request and authorization code.
629
-	*/
628
+	 * OAuth step 1: Redirect to Salesforce and request and authorization code.
629
+	 */
630 630
 	public function get_authorization_code() {
631 631
 		$url = add_query_arg(
632 632
 			array(
@@ -640,11 +640,11 @@  discard block
 block discarded – undo
640 640
 	}
641 641
 
642 642
 	/**
643
-	* OAuth step 2: Exchange an authorization code for an access token.
644
-	*
645
-	* @param string $code
646
-	*   Code from Salesforce.
647
-	*/
643
+	 * OAuth step 2: Exchange an authorization code for an access token.
644
+	 *
645
+	 * @param string $code
646
+	 *   Code from Salesforce.
647
+	 */
648 648
 	public function request_token( $code ) {
649 649
 		$data = array(
650 650
 			'code'          => $code,
@@ -689,22 +689,22 @@  discard block
 block discarded – undo
689 689
 	/* Core API calls */
690 690
 
691 691
 	/**
692
-	* Available objects and their metadata for your organization's data.
693
-	*
694
-	* @param array $conditions
695
-	*   Associative array of filters to apply to the returned objects. Filters
696
-	*   are applied after the list is returned from Salesforce.
697
-	* @param bool $reset
698
-	*   Whether to reset the cache and retrieve a fresh version from Salesforce.
699
-	*
700
-	* @return array
701
-	*   Available objects and metadata.
702
-	*
703
-	* part of core API calls. this call does require authentication, and the basic url it becomes is like this:
704
-	* https://instance.salesforce.com/services/data/v#.0/sobjects
705
-	*
706
-	* updateable is really how the api spells it
707
-	*/
692
+	 * Available objects and their metadata for your organization's data.
693
+	 *
694
+	 * @param array $conditions
695
+	 *   Associative array of filters to apply to the returned objects. Filters
696
+	 *   are applied after the list is returned from Salesforce.
697
+	 * @param bool $reset
698
+	 *   Whether to reset the cache and retrieve a fresh version from Salesforce.
699
+	 *
700
+	 * @return array
701
+	 *   Available objects and metadata.
702
+	 *
703
+	 * part of core API calls. this call does require authentication, and the basic url it becomes is like this:
704
+	 * https://instance.salesforce.com/services/data/v#.0/sobjects
705
+	 *
706
+	 * updateable is really how the api spells it
707
+	 */
708 708
 	public function objects(
709 709
 		$conditions = array(
710 710
 			'updateable'  => true,
@@ -734,22 +734,22 @@  discard block
 block discarded – undo
734 734
 	}
735 735
 
736 736
 	/**
737
-	* Use SOQL to get objects based on query string.
738
-	*
739
-	* @param string $query
740
-	*   The SOQL query.
741
-	* @param array $options
742
-	*   Allow for the query to have options based on what the user needs from it, ie caching, read/write, etc.
743
-	* @param boolean $all
744
-	*   Whether this should get all results for the query
745
-	* @param boolean $explain
746
-	*   If set, Salesforce will return feedback on the query performance
747
-	*
748
-	* @return array
749
-	*   Array of Salesforce objects that match the query.
750
-	*
751
-	* part of core API calls
752
-	*/
737
+	 * Use SOQL to get objects based on query string.
738
+	 *
739
+	 * @param string $query
740
+	 *   The SOQL query.
741
+	 * @param array $options
742
+	 *   Allow for the query to have options based on what the user needs from it, ie caching, read/write, etc.
743
+	 * @param boolean $all
744
+	 *   Whether this should get all results for the query
745
+	 * @param boolean $explain
746
+	 *   If set, Salesforce will return feedback on the query performance
747
+	 *
748
+	 * @return array
749
+	 *   Array of Salesforce objects that match the query.
750
+	 *
751
+	 * part of core API calls
752
+	 */
753 753
 	public function query( $query, $options = array(), $all = false, $explain = false ) {
754 754
 		$search_data = [
755 755
 			'q' => (string) $query,
@@ -769,19 +769,19 @@  discard block
 block discarded – undo
769 769
 	}
770 770
 
771 771
 	/**
772
-	* Retrieve all the metadata for an object.
773
-	*
774
-	* @param string $name
775
-	*   Object type name, E.g., Contact, Account, etc.
776
-	* @param bool $reset
777
-	*   Whether to reset the cache and retrieve a fresh version from Salesforce.
778
-	*
779
-	* @return array
780
-	*   All the metadata for an object, including information about each field,
781
-	*   URLs, and child relationships.
782
-	*
783
-	* part of core API calls
784
-	*/
772
+	 * Retrieve all the metadata for an object.
773
+	 *
774
+	 * @param string $name
775
+	 *   Object type name, E.g., Contact, Account, etc.
776
+	 * @param bool $reset
777
+	 *   Whether to reset the cache and retrieve a fresh version from Salesforce.
778
+	 *
779
+	 * @return array
780
+	 *   All the metadata for an object, including information about each field,
781
+	 *   URLs, and child relationships.
782
+	 *
783
+	 * part of core API calls
784
+	 */
785 785
 	public function object_describe( $name, $reset = false ) {
786 786
 		if ( empty( $name ) ) {
787 787
 			return array();
@@ -809,26 +809,26 @@  discard block
 block discarded – undo
809 809
 	}
810 810
 
811 811
 	/**
812
-	* Create a new object of the given type.
813
-	*
814
-	* @param string $name
815
-	*   Object type name, E.g., Contact, Account, etc.
816
-	* @param array $params
817
-	*   Values of the fields to set for the object.
818
-	*
819
-	* @return array
820
-	*   json: {"id":"00190000001pPvHAAU","success":true,"errors":[]}
821
-	*   code: 201
822
-	*   data:
823
-	*     "id" : "00190000001pPvHAAU",
824
-	*     "success" : true
825
-	*     "errors" : [ ],
826
-	*   from_cache:
827
-	*   cached:
828
-	*   is_redo:
829
-	*
830
-	* part of core API calls
831
-	*/
812
+	 * Create a new object of the given type.
813
+	 *
814
+	 * @param string $name
815
+	 *   Object type name, E.g., Contact, Account, etc.
816
+	 * @param array $params
817
+	 *   Values of the fields to set for the object.
818
+	 *
819
+	 * @return array
820
+	 *   json: {"id":"00190000001pPvHAAU","success":true,"errors":[]}
821
+	 *   code: 201
822
+	 *   data:
823
+	 *     "id" : "00190000001pPvHAAU",
824
+	 *     "success" : true
825
+	 *     "errors" : [ ],
826
+	 *   from_cache:
827
+	 *   cached:
828
+	 *   is_redo:
829
+	 *
830
+	 * part of core API calls
831
+	 */
832 832
 	public function object_create( $name, $params ) {
833 833
 		$options = array(
834 834
 			'type' => 'write',
@@ -838,34 +838,34 @@  discard block
 block discarded – undo
838 838
 	}
839 839
 
840 840
 	/**
841
-	* Create new records or update existing records.
842
-	*
843
-	* The new records or updated records are based on the value of the specified
844
-	* field.  If the value is not unique, REST API returns a 300 response with
845
-	* the list of matching records.
846
-	*
847
-	* @param string $name
848
-	*   Object type name, E.g., Contact, Account.
849
-	* @param string $key
850
-	*   The field to check if this record should be created or updated.
851
-	* @param string $value
852
-	*   The value for this record of the field specified for $key.
853
-	* @param array $params
854
-	*   Values of the fields to set for the object.
855
-	*
856
-	* @return array
857
-	*   json: {"id":"00190000001pPvHAAU","success":true,"errors":[]}
858
-	*   code: 201
859
-	*   data:
860
-	*     "id" : "00190000001pPvHAAU",
861
-	*     "success" : true
862
-	*     "errors" : [ ],
863
-	*   from_cache:
864
-	*   cached:
865
-	*   is_redo:
866
-	*
867
-	* part of core API calls
868
-	*/
841
+	 * Create new records or update existing records.
842
+	 *
843
+	 * The new records or updated records are based on the value of the specified
844
+	 * field.  If the value is not unique, REST API returns a 300 response with
845
+	 * the list of matching records.
846
+	 *
847
+	 * @param string $name
848
+	 *   Object type name, E.g., Contact, Account.
849
+	 * @param string $key
850
+	 *   The field to check if this record should be created or updated.
851
+	 * @param string $value
852
+	 *   The value for this record of the field specified for $key.
853
+	 * @param array $params
854
+	 *   Values of the fields to set for the object.
855
+	 *
856
+	 * @return array
857
+	 *   json: {"id":"00190000001pPvHAAU","success":true,"errors":[]}
858
+	 *   code: 201
859
+	 *   data:
860
+	 *     "id" : "00190000001pPvHAAU",
861
+	 *     "success" : true
862
+	 *     "errors" : [ ],
863
+	 *   from_cache:
864
+	 *   cached:
865
+	 *   is_redo:
866
+	 *
867
+	 * part of core API calls
868
+	 */
869 869
 	public function object_upsert( $name, $key, $value, $params ) {
870 870
 		$options = array(
871 871
 			'type' => 'write',
@@ -887,27 +887,27 @@  discard block
 block discarded – undo
887 887
 	}
888 888
 
889 889
 	/**
890
-	* Update an existing object.
891
-	*
892
-	* @param string $name
893
-	*   Object type name, E.g., Contact, Account.
894
-	* @param string $id
895
-	*   Salesforce id of the object.
896
-	* @param array $params
897
-	*   Values of the fields to set for the object.
898
-	*
899
-	* part of core API calls
900
-	*
901
-	* @return array
902
-	*   json: {"success":true,"body":""}
903
-	*   code: 204
904
-	*   data:
890
+	 * Update an existing object.
891
+	 *
892
+	 * @param string $name
893
+	 *   Object type name, E.g., Contact, Account.
894
+	 * @param string $id
895
+	 *   Salesforce id of the object.
896
+	 * @param array $params
897
+	 *   Values of the fields to set for the object.
898
+	 *
899
+	 * part of core API calls
900
+	 *
901
+	 * @return array
902
+	 *   json: {"success":true,"body":""}
903
+	 *   code: 204
904
+	 *   data:
905 905
 		success: 1
906 906
 		body:
907
-	*   from_cache:
908
-	*   cached:
909
-	*   is_redo:
910
-	*/
907
+	 *   from_cache:
908
+	 *   cached:
909
+	 *   is_redo:
910
+	 */
911 911
 	public function object_update( $name, $id, $params ) {
912 912
 		$options = array(
913 913
 			'type' => 'write',
@@ -917,62 +917,62 @@  discard block
 block discarded – undo
917 917
 	}
918 918
 
919 919
 	/**
920
-	* Return a full loaded Salesforce object.
921
-	*
922
-	* @param string $name
923
-	*   Object type name, E.g., Contact, Account.
924
-	* @param string $id
925
-	*   Salesforce id of the object.
926
-	*
927
-	* @return object
928
-	*   Object of the requested Salesforce object.
929
-	*
930
-	* part of core API calls
931
-	*/
920
+	 * Return a full loaded Salesforce object.
921
+	 *
922
+	 * @param string $name
923
+	 *   Object type name, E.g., Contact, Account.
924
+	 * @param string $id
925
+	 *   Salesforce id of the object.
926
+	 *
927
+	 * @return object
928
+	 *   Object of the requested Salesforce object.
929
+	 *
930
+	 * part of core API calls
931
+	 */
932 932
 	public function object_read( $name, $id ) {
933 933
 		return $this->api_call( "sobjects/{$name}/{$id}", array(), 'GET' );
934 934
 	}
935 935
 
936 936
 	/**
937
-	* Make a call to the Analytics API
938
-	*
939
-	* @param string $name
940
-	*   Object type name, E.g., Report
941
-	* @param string $id
942
-	*   Salesforce id of the object.
943
-	* @param string $route
944
-	*   What comes after the ID? E.g. instances, ?includeDetails=True
945
-	* @param array $params
946
-	*   Params to put with the request
947
-	* @param string $method
948
-	*   GET or POST
949
-	*
950
-	* @return object
951
-	*   Object of the requested Salesforce object.
952
-	*
953
-	* part of core API calls
954
-	*/
937
+	 * Make a call to the Analytics API
938
+	 *
939
+	 * @param string $name
940
+	 *   Object type name, E.g., Report
941
+	 * @param string $id
942
+	 *   Salesforce id of the object.
943
+	 * @param string $route
944
+	 *   What comes after the ID? E.g. instances, ?includeDetails=True
945
+	 * @param array $params
946
+	 *   Params to put with the request
947
+	 * @param string $method
948
+	 *   GET or POST
949
+	 *
950
+	 * @return object
951
+	 *   Object of the requested Salesforce object.
952
+	 *
953
+	 * part of core API calls
954
+	 */
955 955
 	public function analytics_api( $name, $id, $route = '', $params = array(), $method = 'GET' ) {
956 956
 		return $this->api_call( "analytics/{$name}/{$id}/{$route}", $params, $method );
957 957
 	}
958 958
 
959 959
 	/**
960
-	* Run a specific Analytics report
961
-	*
962
-	* @param string $id
963
-	*   Salesforce id of the object.
964
-	* @param bool $async
965
-	*   Whether the report is asynchronous
966
-	* @param array $params
967
-	*   Params to put with the request
968
-	* @param string $method
969
-	*   GET or POST
970
-	*
971
-	* @return object
972
-	*   Object of the requested Salesforce object.
973
-	*
974
-	* part of core API calls
975
-	*/
960
+	 * Run a specific Analytics report
961
+	 *
962
+	 * @param string $id
963
+	 *   Salesforce id of the object.
964
+	 * @param bool $async
965
+	 *   Whether the report is asynchronous
966
+	 * @param array $params
967
+	 *   Params to put with the request
968
+	 * @param string $method
969
+	 *   GET or POST
970
+	 *
971
+	 * @return object
972
+	 *   Object of the requested Salesforce object.
973
+	 *
974
+	 * part of core API calls
975
+	 */
976 976
 	public function run_analytics_report( $id, $async = true, $clear_cache = false, $params = array(), $method = 'GET', $report_cache_expiration = '', $cache_instance = true, $instance_cache_expiration = '' ) {
977 977
 
978 978
 		$id         = $this->convert_id( $id );
@@ -1058,36 +1058,36 @@  discard block
 block discarded – undo
1058 1058
 	}
1059 1059
 
1060 1060
 	/**
1061
-	* Return a full loaded Salesforce object from External ID.
1062
-	*
1063
-	* @param string $name
1064
-	*   Object type name, E.g., Contact, Account.
1065
-	* @param string $field
1066
-	*   Salesforce external id field name.
1067
-	* @param string $value
1068
-	*   Value of external id.
1069
-	*
1070
-	* @return object
1071
-	*   Object of the requested Salesforce object.
1072
-	*
1073
-	* part of core API calls
1074
-	*/
1061
+	 * Return a full loaded Salesforce object from External ID.
1062
+	 *
1063
+	 * @param string $name
1064
+	 *   Object type name, E.g., Contact, Account.
1065
+	 * @param string $field
1066
+	 *   Salesforce external id field name.
1067
+	 * @param string $value
1068
+	 *   Value of external id.
1069
+	 *
1070
+	 * @return object
1071
+	 *   Object of the requested Salesforce object.
1072
+	 *
1073
+	 * part of core API calls
1074
+	 */
1075 1075
 	public function object_readby_external_id( $name, $field, $value ) {
1076 1076
 		return $this->api_call( "sobjects/{$name}/{$field}/{$value}" );
1077 1077
 	}
1078 1078
 
1079 1079
 	/**
1080
-	* Delete a Salesforce object.
1081
-	*
1082
-	* @param string $name
1083
-	*   Object type name, E.g., Contact, Account.
1084
-	* @param string $id
1085
-	*   Salesforce id of the object.
1086
-	*
1087
-	* @return array
1088
-	*
1089
-	* part of core API calls
1090
-	*/
1080
+	 * Delete a Salesforce object.
1081
+	 *
1082
+	 * @param string $name
1083
+	 *   Object type name, E.g., Contact, Account.
1084
+	 * @param string $id
1085
+	 *   Salesforce id of the object.
1086
+	 *
1087
+	 * @return array
1088
+	 *
1089
+	 * part of core API calls
1090
+	 */
1091 1091
 	public function object_delete( $name, $id ) {
1092 1092
 		$options = array(
1093 1093
 			'type' => 'write',
@@ -1097,17 +1097,17 @@  discard block
 block discarded – undo
1097 1097
 	}
1098 1098
 
1099 1099
 	/**
1100
-	* Retrieves the list of individual objects that have been deleted within the
1101
-	* given timespan for a specified object type.
1102
-	*
1103
-	* @param string $type
1104
-	*   Object type name, E.g., Contact, Account.
1105
-	* @param string $startDate
1106
-	*   Start date to check for deleted objects (in ISO 8601 format).
1107
-	* @param string $endDate
1108
-	*   End date to check for deleted objects (in ISO 8601 format).
1109
-	* @return GetDeletedResult
1110
-	*/
1100
+	 * Retrieves the list of individual objects that have been deleted within the
1101
+	 * given timespan for a specified object type.
1102
+	 *
1103
+	 * @param string $type
1104
+	 *   Object type name, E.g., Contact, Account.
1105
+	 * @param string $startDate
1106
+	 *   Start date to check for deleted objects (in ISO 8601 format).
1107
+	 * @param string $endDate
1108
+	 *   End date to check for deleted objects (in ISO 8601 format).
1109
+	 * @return GetDeletedResult
1110
+	 */
1111 1111
 	public function get_deleted( $type, $start_date, $end_date ) {
1112 1112
 		$options = array(
1113 1113
 			'cache' => false,
@@ -1117,13 +1117,13 @@  discard block
 block discarded – undo
1117 1117
 
1118 1118
 
1119 1119
 	/**
1120
-	* Return a list of available resources for the configured API version.
1121
-	*
1122
-	* @return array
1123
-	*   Associative array keyed by name with a URI value.
1124
-	*
1125
-	* part of core API calls
1126
-	*/
1120
+	 * Return a list of available resources for the configured API version.
1121
+	 *
1122
+	 * @return array
1123
+	 *   Associative array keyed by name with a URI value.
1124
+	 *
1125
+	 * part of core API calls
1126
+	 */
1127 1127
 	public function list_resources() {
1128 1128
 		$resources = $this->api_call( '' );
1129 1129
 		foreach ( $resources as $key => $path ) {
@@ -1133,31 +1133,31 @@  discard block
 block discarded – undo
1133 1133
 	}
1134 1134
 
1135 1135
 	/**
1136
-	* Return a list of SFIDs for the given object, which have been created or
1137
-	* updated in the given timeframe.
1138
-	*
1139
-	* @param string $type
1140
-	*   Object type name, E.g., Contact, Account.
1141
-	*
1142
-	* @param int $start
1143
-	*   unix timestamp for older timeframe for updates.
1144
-	*   Defaults to "-29 days" if empty.
1145
-	*
1146
-	* @param int $end
1147
-	*   unix timestamp for end of timeframe for updates.
1148
-	*   Defaults to now if empty
1149
-	*
1150
-	* @return array
1151
-	*   return array has 2 indexes:
1152
-	*     "ids": a list of SFIDs of those records which have been created or
1153
-	*       updated in the given timeframe.
1154
-	*     "latestDateCovered": ISO 8601 format timestamp (UTC) of the last date
1155
-	*       covered in the request.
1156
-	*
1157
-	* @see https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_getupdated.htm
1158
-	*
1159
-	* part of core API calls
1160
-	*/
1136
+	 * Return a list of SFIDs for the given object, which have been created or
1137
+	 * updated in the given timeframe.
1138
+	 *
1139
+	 * @param string $type
1140
+	 *   Object type name, E.g., Contact, Account.
1141
+	 *
1142
+	 * @param int $start
1143
+	 *   unix timestamp for older timeframe for updates.
1144
+	 *   Defaults to "-29 days" if empty.
1145
+	 *
1146
+	 * @param int $end
1147
+	 *   unix timestamp for end of timeframe for updates.
1148
+	 *   Defaults to now if empty
1149
+	 *
1150
+	 * @return array
1151
+	 *   return array has 2 indexes:
1152
+	 *     "ids": a list of SFIDs of those records which have been created or
1153
+	 *       updated in the given timeframe.
1154
+	 *     "latestDateCovered": ISO 8601 format timestamp (UTC) of the last date
1155
+	 *       covered in the request.
1156
+	 *
1157
+	 * @see https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_getupdated.htm
1158
+	 *
1159
+	 * part of core API calls
1160
+	 */
1161 1161
 	public function get_updated( $type, $start = null, $end = null ) {
1162 1162
 		if ( empty( $start ) ) {
1163 1163
 			$start = strtotime( '-29 days' );
@@ -1176,19 +1176,19 @@  discard block
 block discarded – undo
1176 1176
 	}
1177 1177
 
1178 1178
 	/**
1179
-	* Given a DeveloperName and SObject Name, return the SFID of the
1180
-	* corresponding RecordType. DeveloperName doesn't change between Salesforce
1181
-	* environments, so it's safer to rely on compared to SFID.
1182
-	*
1183
-	* @param string $name
1184
-	*   Object type name, E.g., Contact, Account.
1185
-	*
1186
-	* @param string $devname
1187
-	*   RecordType DeveloperName, e.g. Donation, Membership, etc.
1188
-	*
1189
-	* @return string SFID
1190
-	*   The Salesforce ID of the given Record Type, or null.
1191
-	*/
1179
+	 * Given a DeveloperName and SObject Name, return the SFID of the
1180
+	 * corresponding RecordType. DeveloperName doesn't change between Salesforce
1181
+	 * environments, so it's safer to rely on compared to SFID.
1182
+	 *
1183
+	 * @param string $name
1184
+	 *   Object type name, E.g., Contact, Account.
1185
+	 *
1186
+	 * @param string $devname
1187
+	 *   RecordType DeveloperName, e.g. Donation, Membership, etc.
1188
+	 *
1189
+	 * @return string SFID
1190
+	 *   The Salesforce ID of the given Record Type, or null.
1191
+	 */
1192 1192
 
1193 1193
 	public function get_record_type_id_by_developer_name( $name, $devname, $reset = false ) {
1194 1194
 
@@ -1216,10 +1216,10 @@  discard block
 block discarded – undo
1216 1216
 	}
1217 1217
 
1218 1218
 	/**
1219
-	* If there is a WordPress setting for how long to keep the cache, return it and set the object property
1220
-	* Otherwise, return seconds in 24 hours
1221
-	*
1222
-	*/
1219
+	 * If there is a WordPress setting for how long to keep the cache, return it and set the object property
1220
+	 * Otherwise, return seconds in 24 hours
1221
+	 *
1222
+	 */
1223 1223
 	private function cache_expiration() {
1224 1224
 		$cache_expiration = $this->wordpress->cache_expiration( $this->option_prefix . 'cache_expiration', 86400 );
1225 1225
 		return $cache_expiration;
Please login to merge, or discard this patch.
classes/salesforce_pull.php 1 patch
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -26,26 +26,26 @@  discard block
 block discarded – undo
26 26
 	protected $queue;
27 27
 
28 28
 	/**
29
-	* @var string
30
-	*/
29
+	 * @var string
30
+	 */
31 31
 	public $schedule_name; // allow for naming the queue in case there are multiple queues
32 32
 
33 33
 	/**
34
-	* Constructor which sets up pull schedule
35
-	*
36
-	* @param object $wpdb
37
-	* @param string $version
38
-	* @param array $login_credentials
39
-	* @param string $slug
40
-	* @param string $option_prefix
41
-	* @param object $wordpress
42
-	* @param object $salesforce
43
-	* @param object $mappings
44
-	* @param object $logging
45
-	* @param array $schedulable_classes
46
-	* @param object $queue
47
-	* @throws \Exception
48
-	*/
34
+	 * Constructor which sets up pull schedule
35
+	 *
36
+	 * @param object $wpdb
37
+	 * @param string $version
38
+	 * @param array $login_credentials
39
+	 * @param string $slug
40
+	 * @param string $option_prefix
41
+	 * @param object $wordpress
42
+	 * @param object $salesforce
43
+	 * @param object $mappings
44
+	 * @param object $logging
45
+	 * @param array $schedulable_classes
46
+	 * @param object $queue
47
+	 * @throws \Exception
48
+	 */
49 49
 	public function __construct( $wpdb, $version, $login_credentials, $slug, $option_prefix, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes, $queue ) {
50 50
 		$this->wpdb                = $wpdb;
51 51
 		$this->version             = $version;
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 	}
70 70
 
71 71
 	/**
72
-	* Create the action hooks based on what object maps exist from the admin settings
73
-	*
74
-	*/
72
+	 * Create the action hooks based on what object maps exist from the admin settings
73
+	 *
74
+	 */
75 75
 	public function add_actions() {
76 76
 
77 77
 		// ajax hook
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 	}
84 84
 
85 85
 	/**
86
-	* Ajax callback for salesforce pull. Returns status of 200 for successful
87
-	* attempt or 403 for a failed pull attempt (SF not authorized, threshhold
88
-	* reached, etc.
89
-	* this is the ajax callback; not a cron run
90
-	*/
86
+	 * Ajax callback for salesforce pull. Returns status of 200 for successful
87
+	 * attempt or 403 for a failed pull attempt (SF not authorized, threshhold
88
+	 * reached, etc.
89
+	 * this is the ajax callback; not a cron run
90
+	 */
91 91
 	public function salesforce_pull_webhook() {
92 92
 
93 93
 		if ( true === $this->salesforce_pull() ) {
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 
115 115
 	/**
116
-	* Callback for the standard pull process used by webhooks and cron.
117
-	*/
116
+	 * Callback for the standard pull process used by webhooks and cron.
117
+	 */
118 118
 	public function salesforce_pull() {
119 119
 		$sfapi = $this->salesforce['sfapi'];
120 120
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 	}
135 135
 
136 136
 	/**
137
-	* Determines if the Salesforce pull should be allowed, or throttled.
138
-	*
139
-	* Prevents too many pull processes from running at once.
140
-	*
141
-	* @return bool
142
-	*    Returns false if the time elapsed between recent pulls is too short.
143
-	*/
137
+	 * Determines if the Salesforce pull should be allowed, or throttled.
138
+	 *
139
+	 * Prevents too many pull processes from running at once.
140
+	 *
141
+	 * @return bool
142
+	 *    Returns false if the time elapsed between recent pulls is too short.
143
+	 */
144 144
 	private function check_throttle() {
145 145
 		$pull_throttle = get_option( $this->option_prefix . 'pull_throttle', 5 );
146 146
 		$last_sync     = get_option( $this->option_prefix . 'pull_last_sync', 0 );
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
 	}
154 154
 
155 155
 	/**
156
-	* Pull updated records from Salesforce and place them in the queue.
157
-	*
158
-	* Executes a SOQL query based on defined mappings, loops through the results,
159
-	* and places each updated SF object into the queue for later processing.
160
-	*
161
-	* We copy the convention from the Drupal module here, and run a separate SOQL query for each type of object in SF
162
-	*
163
-	*/
156
+	 * Pull updated records from Salesforce and place them in the queue.
157
+	 *
158
+	 * Executes a SOQL query based on defined mappings, loops through the results,
159
+	 * and places each updated SF object into the queue for later processing.
160
+	 *
161
+	 * We copy the convention from the Drupal module here, and run a separate SOQL query for each type of object in SF
162
+	 *
163
+	 */
164 164
 	private function get_updated_records() {
165 165
 		$sfapi = $this->salesforce['sfapi'];
166 166
 		foreach ( $this->mappings->get_fieldmaps() as $salesforce_mapping ) {
@@ -344,18 +344,18 @@  discard block
 block discarded – undo
344 344
 	}
345 345
 
346 346
 	/**
347
-	* Given a SObject type name, build an SOQL query to include all fields for all
348
-	* SalesforceMappings mapped to that SObject.
349
-	*
350
-	* @param string $type
351
-	*   e.g. "Contact", "Account", etc.
352
-	*
353
-	* @return Object_Sync_Sf_Salesforce_Select_Query or null if no mappings or no mapped fields
354
-	*   were found.
355
-	*
356
-	* @see Object_Sync_Sf_Mapping::get_mapped_fields
357
-	* @see Object_Sync_Sf_Mapping::get_mapped_record_types
358
-	*/
347
+	 * Given a SObject type name, build an SOQL query to include all fields for all
348
+	 * SalesforceMappings mapped to that SObject.
349
+	 *
350
+	 * @param string $type
351
+	 *   e.g. "Contact", "Account", etc.
352
+	 *
353
+	 * @return Object_Sync_Sf_Salesforce_Select_Query or null if no mappings or no mapped fields
354
+	 *   were found.
355
+	 *
356
+	 * @see Object_Sync_Sf_Mapping::get_mapped_fields
357
+	 * @see Object_Sync_Sf_Mapping::get_mapped_record_types
358
+	 */
359 359
 	private function get_pull_query( $type, $salesforce_mapping = array() ) {
360 360
 		$mapped_fields       = array();
361 361
 		$mapped_record_types = array();
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
 	}
441 441
 
442 442
 	/**
443
-	* Get deleted records from salesforce.
444
-	* Note that deletions can only be queried via REST with an API version >= 29.0.
445
-	*
446
-	*/
443
+	 * Get deleted records from salesforce.
444
+	 * Note that deletions can only be queried via REST with an API version >= 29.0.
445
+	 *
446
+	 */
447 447
 	private function get_deleted_records() {
448 448
 
449 449
 		$sfapi = $this->salesforce['sfapi'];
@@ -544,13 +544,13 @@  discard block
 block discarded – undo
544 544
 	}
545 545
 
546 546
 	/**
547
-	* Method for ajax hooks to call for pulling manually
548
-	*
549
-	* @param string $object_type
550
-	* @param string $salesforce_id
551
-	* @param string $wordpress_object
552
-	*
553
-	*/
547
+	 * Method for ajax hooks to call for pulling manually
548
+	 *
549
+	 * @param string $object_type
550
+	 * @param string $salesforce_id
551
+	 * @param string $wordpress_object
552
+	 *
553
+	 */
554 554
 	public function manual_pull( $object_type, $salesforce_id, $wordpress_object ) {
555 555
 		$sfapi   = $this->salesforce['sfapi'];
556 556
 		$object  = $sfapi->api_call( 'sobjects/' . $object_type . '/' . $salesforce_id );
@@ -565,20 +565,20 @@  discard block
 block discarded – undo
565 565
 	}
566 566
 
567 567
 	/**
568
-	* Sync WordPress objects and Salesforce objects from the queue using the REST API.
569
-	*
570
-	* @param string $object_type
571
-	*   Type of Salesforce object.
572
-	* @param array|string $object
573
-	*   The Salesforce data or its Id value.
574
-	* @param array|int $mapping
575
-	*   Salesforce/WP mapping data or its id.
576
-	* @param int $sf_sync_trigger
577
-	*   Trigger for this sync.
578
-	*
579
-	* @return true or exit the method
580
-	*
581
-	*/
568
+	 * Sync WordPress objects and Salesforce objects from the queue using the REST API.
569
+	 *
570
+	 * @param string $object_type
571
+	 *   Type of Salesforce object.
572
+	 * @param array|string $object
573
+	 *   The Salesforce data or its Id value.
574
+	 * @param array|int $mapping
575
+	 *   Salesforce/WP mapping data or its id.
576
+	 * @param int $sf_sync_trigger
577
+	 *   Trigger for this sync.
578
+	 *
579
+	 * @return true or exit the method
580
+	 *
581
+	 */
582 582
 	public function salesforce_pull_process_records( $object_type, $object, $mapping, $sf_sync_trigger ) {
583 583
 
584 584
 		$sfapi = $this->salesforce['sfapi'];
@@ -1308,19 +1308,19 @@  discard block
 block discarded – undo
1308 1308
 	}
1309 1309
 
1310 1310
 	/**
1311
-	* Create an object map between a Salesforce object and a WordPress object
1312
-	*
1313
-	* @param array $salesforce_object
1314
-	*   Array of the salesforce object's data
1315
-	* @param string $wordpress_id
1316
-	*   Unique identifier for the WordPress object
1317
-	* @param array $field_mapping
1318
-	*   The row that maps the object types together, including which fields match which other fields
1319
-	*
1320
-	* @return int $wpdb->insert_id
1321
-	*   This is the database row for the map object
1322
-	*
1323
-	*/
1311
+	 * Create an object map between a Salesforce object and a WordPress object
1312
+	 *
1313
+	 * @param array $salesforce_object
1314
+	 *   Array of the salesforce object's data
1315
+	 * @param string $wordpress_id
1316
+	 *   Unique identifier for the WordPress object
1317
+	 * @param array $field_mapping
1318
+	 *   The row that maps the object types together, including which fields match which other fields
1319
+	 *
1320
+	 * @return int $wpdb->insert_id
1321
+	 *   This is the database row for the map object
1322
+	 *
1323
+	 */
1324 1324
 	private function create_object_map( $salesforce_object, $wordpress_id, $field_mapping ) {
1325 1325
 		// Create object map and save it
1326 1326
 		$mapping_object = $this->mappings->create_object_map(
Please login to merge, or discard this patch.