Test Setup Failed
Pull Request — master (#174)
by Jonathan
03:34
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/activate.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 	protected $installed_version;
20 20
 
21 21
 	/**
22
-	* Constructor which sets up activate hooks
23
-	*
24
-	* @param object $wpdb
25
-	* @param string $version
26
-	* @param string $slug
27
-	*
28
-	*/
22
+	 * Constructor which sets up activate hooks
23
+	 *
24
+	 * @param object $wpdb
25
+	 * @param string $version
26
+	 * @param string $slug
27
+	 *
28
+	 */
29 29
 	public function __construct( $wpdb, $version, $slug ) {
30 30
 		$this->wpdb              = $wpdb;
31 31
 		$this->version           = $version;
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	}
38 38
 
39 39
 	/**
40
-	* Check for the minimum required version of php
41
-	*/
40
+	 * Check for the minimum required version of php
41
+	 */
42 42
 	public function php_requirements() {
43 43
 		if ( version_compare( PHP_VERSION, '5.5', '<' ) ) {
44 44
 			deactivate_plugins( plugin_basename( __FILE__ ) );
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 	}
48 48
 
49 49
 	/**
50
-	* Create database tables for Salesforce
51
-	* This creates tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
52
-	*
53
-	*/
50
+	 * Create database tables for Salesforce
51
+	 * This creates tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
52
+	 *
53
+	 */
54 54
 	public function wordpress_salesforce_tables() {
55 55
 
56 56
 		$charset_collate = $this->wpdb->get_charset_collate();
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
 	}
112 112
 
113 113
 	/**
114
-	* Check for database version on plugin upgrade
115
-	* When the plugin is upgraded, if the database version does not match the current version, perform these methods
116
-	*
117
-	*/
114
+	 * Check for database version on plugin upgrade
115
+	 * When the plugin is upgraded, if the database version does not match the current version, perform these methods
116
+	 *
117
+	 */
118 118
 	public function wordpress_salesforce_update_db_check() {
119 119
 		if ( get_site_option( 'object_sync_for_salesforce_db_version' ) !== $this->version ) {
120 120
 			$this->wordpress_salesforce_tables();
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 	}
123 123
 
124 124
 	/**
125
-	* Add roles and capabilities
126
-	* This adds the configure_salesforce capability to the admin role
127
-	*
128
-	* It also allows other plugins to add the capability to other roles
129
-	*
130
-	*/
125
+	 * Add roles and capabilities
126
+	 * This adds the configure_salesforce capability to the admin role
127
+	 *
128
+	 * It also allows other plugins to add the capability to other roles
129
+	 *
130
+	 */
131 131
 	public function add_roles_capabilities() {
132 132
 
133 133
 		// by default, only administrators can configure the plugin
Please login to merge, or discard this patch.
classes/salesforce_pull.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -24,24 +24,24 @@  discard block
 block discarded – undo
24 24
 	protected $schedulable_classes;
25 25
 
26 26
 	/**
27
-	* @var string
28
-	*/
27
+	 * @var string
28
+	 */
29 29
 	public $schedule_name; // allow for naming the queue in case there are multiple queues
30 30
 
31 31
 	/**
32
-	* Constructor which sets up pull schedule
33
-	*
34
-	* @param object $wpdb
35
-	* @param string $version
36
-	* @param array $login_credentials
37
-	* @param string $slug
38
-	* @param object $wordpress
39
-	* @param object $salesforce
40
-	* @param object $mappings
41
-	* @param object $logging
42
-	* @param array $schedulable_classes
43
-	* @throws \Exception
44
-	*/
32
+	 * Constructor which sets up pull schedule
33
+	 *
34
+	 * @param object $wpdb
35
+	 * @param string $version
36
+	 * @param array $login_credentials
37
+	 * @param string $slug
38
+	 * @param object $wordpress
39
+	 * @param object $salesforce
40
+	 * @param object $mappings
41
+	 * @param object $logging
42
+	 * @param array $schedulable_classes
43
+	 * @throws \Exception
44
+	 */
45 45
 	public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes ) {
46 46
 		$this->wpdb                = $wpdb;
47 47
 		$this->version             = $version;
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
 	}
71 71
 
72 72
 	/**
73
-	* Create the action hooks based on what object maps exist from the admin settings
74
-	*
75
-	*/
73
+	 * Create the action hooks based on what object maps exist from the admin settings
74
+	 *
75
+	 */
76 76
 	private function add_actions() {
77 77
 		add_action( 'wp_ajax_salesforce_pull_webhook', array( $this, 'salesforce_pull_webhook' ) );
78 78
 	}
79 79
 
80 80
 	/**
81
-	* Ajax callback for salesforce pull. Returns status of 200 for successful
82
-	* attempt or 403 for a failed pull attempt (SF not authorized, threshhold
83
-	* reached, etc.
84
-	* this is the ajax callback; not a cron run
85
-	*/
81
+	 * Ajax callback for salesforce pull. Returns status of 200 for successful
82
+	 * attempt or 403 for a failed pull attempt (SF not authorized, threshhold
83
+	 * reached, etc.
84
+	 * this is the ajax callback; not a cron run
85
+	 */
86 86
 	public function salesforce_pull_webhook() {
87 87
 
88 88
 		if ( true === $this->salesforce_pull() ) {
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	}
103 103
 
104 104
 	/**
105
-	* Callback for the standard pull process used by webhooks and cron.
106
-	*/
105
+	 * Callback for the standard pull process used by webhooks and cron.
106
+	 */
107 107
 	public function salesforce_pull() {
108 108
 		$sfapi = $this->salesforce['sfapi'];
109 109
 
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 	}
124 124
 
125 125
 	/**
126
-	* Load schedule
127
-	* This loads the schedule class
128
-	*/
126
+	 * Load schedule
127
+	 * This loads the schedule class
128
+	 */
129 129
 	private function schedule() {
130 130
 		if ( ! class_exists( 'Object_Sync_Sf_Schedule' ) && file_exists( plugin_dir_path( __FILE__ ) . '../vendor/autoload.php' ) ) {
131 131
 			require_once plugin_dir_path( __FILE__ ) . '../vendor/autoload.php';
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
 	}
138 138
 
139 139
 	/**
140
-	* Determines if the Salesforce pull should be allowed, or throttled.
141
-	*
142
-	* Prevents too many pull processes from running at once.
143
-	*
144
-	* @return bool
145
-	*    Returns false if the time elapsed between recent pulls is too short.
146
-	*/
140
+	 * Determines if the Salesforce pull should be allowed, or throttled.
141
+	 *
142
+	 * Prevents too many pull processes from running at once.
143
+	 *
144
+	 * @return bool
145
+	 *    Returns false if the time elapsed between recent pulls is too short.
146
+	 */
147 147
 	private function check_throttle() {
148 148
 		$pull_throttle = get_option( 'object_sync_for_salesforce_pull_throttle', 5 );
149 149
 		$last_sync     = get_option( 'object_sync_for_salesforce_pull_last_sync', 0 );
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
 	}
157 157
 
158 158
 	/**
159
-	* Pull updated records from Salesforce and place them in the queue.
160
-	*
161
-	* Executes a SOQL query based on defined mappings, loops through the results,
162
-	* and places each updated SF object into the queue for later processing.
163
-	*
164
-	* We copy the convention from the Drupal module here, and run a separate SOQL query for each type of object in SF
165
-	*
166
-	*/
159
+	 * Pull updated records from Salesforce and place them in the queue.
160
+	 *
161
+	 * Executes a SOQL query based on defined mappings, loops through the results,
162
+	 * and places each updated SF object into the queue for later processing.
163
+	 *
164
+	 * We copy the convention from the Drupal module here, and run a separate SOQL query for each type of object in SF
165
+	 *
166
+	 */
167 167
 	private function get_updated_records() {
168 168
 		$sfapi = $this->salesforce['sfapi'];
169 169
 		foreach ( $this->mappings->get_fieldmaps() as $salesforce_mapping ) {
@@ -329,18 +329,18 @@  discard block
 block discarded – undo
329 329
 	}
330 330
 
331 331
 	/**
332
-	* Given a SObject type name, build an SOQL query to include all fields for all
333
-	* SalesforceMappings mapped to that SObject.
334
-	*
335
-	* @param string $type
336
-	*   e.g. "Contact", "Account", etc.
337
-	*
338
-	* @return Object_Sync_Sf_Salesforce_Select_Query or null if no mappings or no mapped fields
339
-	*   were found.
340
-	*
341
-	* @see Object_Sync_Sf_Mapping::get_mapped_fields
342
-	* @see Object_Sync_Sf_Mapping::get_mapped_record_types
343
-	*/
332
+	 * Given a SObject type name, build an SOQL query to include all fields for all
333
+	 * SalesforceMappings mapped to that SObject.
334
+	 *
335
+	 * @param string $type
336
+	 *   e.g. "Contact", "Account", etc.
337
+	 *
338
+	 * @return Object_Sync_Sf_Salesforce_Select_Query or null if no mappings or no mapped fields
339
+	 *   were found.
340
+	 *
341
+	 * @see Object_Sync_Sf_Mapping::get_mapped_fields
342
+	 * @see Object_Sync_Sf_Mapping::get_mapped_record_types
343
+	 */
344 344
 	private function get_pull_query( $type, $salesforce_mapping = array() ) {
345 345
 		$mapped_fields       = array();
346 346
 		$mapped_record_types = array();
@@ -422,10 +422,10 @@  discard block
 block discarded – undo
422 422
 	}
423 423
 
424 424
 	/**
425
-	* Get deleted records from salesforce.
426
-	* Note that deletions can only be queried via REST with an API version >= 29.0.
427
-	*
428
-	*/
425
+	 * Get deleted records from salesforce.
426
+	 * Note that deletions can only be queried via REST with an API version >= 29.0.
427
+	 *
428
+	 */
429 429
 	private function get_deleted_records() {
430 430
 
431 431
 		$sfapi = $this->salesforce['sfapi'];
@@ -517,13 +517,13 @@  discard block
 block discarded – undo
517 517
 	}
518 518
 
519 519
 	/**
520
-	* Method for ajax hooks to call for pulling manually
521
-	*
522
-	* @param string $object_type
523
-	* @param string $salesforce_id
524
-	* @param string $wordpress_object
525
-	*
526
-	*/
520
+	 * Method for ajax hooks to call for pulling manually
521
+	 *
522
+	 * @param string $object_type
523
+	 * @param string $salesforce_id
524
+	 * @param string $wordpress_object
525
+	 *
526
+	 */
527 527
 	public function manual_pull( $object_type, $salesforce_id, $wordpress_object ) {
528 528
 		$sfapi   = $this->salesforce['sfapi'];
529 529
 		$object  = $sfapi->api_call( 'sobjects/' . $object_type . '/' . $salesforce_id );
@@ -538,20 +538,20 @@  discard block
 block discarded – undo
538 538
 	}
539 539
 
540 540
 	/**
541
-	* Sync WordPress objects and Salesforce objects from the queue using the REST API.
542
-	*
543
-	* @param string $object_type
544
-	*   Type of Salesforce object.
545
-	* @param object $object
546
-	*   The Salesforce object.
547
-	* @param object $mapping
548
-	*   Salesforce/WP mapping object.
549
-	* @param int $sf_sync_trigger
550
-	*   Trigger for this sync.
551
-	*
552
-	* @return true or exit the method
553
-	*
554
-	*/
541
+	 * Sync WordPress objects and Salesforce objects from the queue using the REST API.
542
+	 *
543
+	 * @param string $object_type
544
+	 *   Type of Salesforce object.
545
+	 * @param object $object
546
+	 *   The Salesforce object.
547
+	 * @param object $mapping
548
+	 *   Salesforce/WP mapping object.
549
+	 * @param int $sf_sync_trigger
550
+	 *   Trigger for this sync.
551
+	 *
552
+	 * @return true or exit the method
553
+	 *
554
+	 */
555 555
 	public function salesforce_pull_process_records( $object_type, $object, $mapping, $sf_sync_trigger ) {
556 556
 		$mapping_conditions = array(
557 557
 			'salesforce_object' => $object_type,
@@ -1282,19 +1282,19 @@  discard block
 block discarded – undo
1282 1282
 	}
1283 1283
 
1284 1284
 	/**
1285
-	* Create an object map between a Salesforce object and a WordPress object
1286
-	*
1287
-	* @param array $salesforce_object
1288
-	*   Array of the salesforce object's data
1289
-	* @param string $wordpress_id
1290
-	*   Unique identifier for the WordPress object
1291
-	* @param array $field_mapping
1292
-	*   The row that maps the object types together, including which fields match which other fields
1293
-	*
1294
-	* @return int $wpdb->insert_id
1295
-	*   This is the database row for the map object
1296
-	*
1297
-	*/
1285
+	 * Create an object map between a Salesforce object and a WordPress object
1286
+	 *
1287
+	 * @param array $salesforce_object
1288
+	 *   Array of the salesforce object's data
1289
+	 * @param string $wordpress_id
1290
+	 *   Unique identifier for the WordPress object
1291
+	 * @param array $field_mapping
1292
+	 *   The row that maps the object types together, including which fields match which other fields
1293
+	 *
1294
+	 * @return int $wpdb->insert_id
1295
+	 *   This is the database row for the map object
1296
+	 *
1297
+	 */
1298 1298
 	private function create_object_map( $salesforce_object, $wordpress_id, $field_mapping ) {
1299 1299
 		// Create object map and save it
1300 1300
 		$mapping_object = $this->mappings->create_object_map(
Please login to merge, or discard this patch.
classes/salesforce_push.php 1 patch
Indentation   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -24,24 +24,24 @@  discard block
 block discarded – undo
24 24
 	protected $schedulable_classes;
25 25
 
26 26
 	/**
27
-	* @var string
28
-	*/
27
+	 * @var string
28
+	 */
29 29
 	public $schedule_name; // allow for naming the queue in case there are multiple queues
30 30
 
31 31
 	/**
32
-	* Constructor which sets up push schedule
33
-	*
34
-	* @param object $wpdb
35
-	* @param string $version
36
-	* @param array $login_credentials
37
-	* @param string $slug
38
-	* @param object $wordpress
39
-	* @param object $salesforce
40
-	* @param object $mappings
41
-	* @param object $logging
42
-	* @param array $schedulable_classes
43
-	* @throws \Object_Sync_Sf_Exception
44
-	*/
32
+	 * Constructor which sets up push schedule
33
+	 *
34
+	 * @param object $wpdb
35
+	 * @param string $version
36
+	 * @param array $login_credentials
37
+	 * @param string $slug
38
+	 * @param object $wordpress
39
+	 * @param object $salesforce
40
+	 * @param object $mappings
41
+	 * @param object $logging
42
+	 * @param array $schedulable_classes
43
+	 * @throws \Object_Sync_Sf_Exception
44
+	 */
45 45
 	public function __construct( $wpdb, $version, $login_credentials, $slug, $wordpress, $salesforce, $mappings, $logging, $schedulable_classes ) {
46 46
 		$this->wpdb                = $wpdb;
47 47
 		$this->version             = $version;
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 	}
63 63
 
64 64
 	/**
65
-	* Create the action hooks based on what object maps exist from the admin settings.
66
-	* We do not have any actions for blogroll at this time.
67
-	*
68
-	*/
65
+	 * Create the action hooks based on what object maps exist from the admin settings.
66
+	 * We do not have any actions for blogroll at this time.
67
+	 *
68
+	 */
69 69
 	private function add_actions() {
70 70
 		$db_version = get_option( 'object_sync_for_salesforce_db_version', false );
71 71
 		if ( $db_version === $this->version ) {
@@ -97,54 +97,54 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 
99 99
 	/**
100
-	* Method for ajax hooks to call for pushing manually
101
-	*
102
-	* @param array $object
103
-	* @param string $type
104
-	*
105
-	*/
100
+	 * Method for ajax hooks to call for pushing manually
101
+	 *
102
+	 * @param array $object
103
+	 * @param string $type
104
+	 *
105
+	 */
106 106
 	public function manual_object_update( $object, $type ) {
107 107
 		$this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_update, true );
108 108
 	}
109 109
 
110 110
 	/**
111
-	* Callback method for adding a user
112
-	*
113
-	* @param string $user_id
114
-	*/
111
+	 * Callback method for adding a user
112
+	 *
113
+	 * @param string $user_id
114
+	 */
115 115
 	public function add_user( $user_id ) {
116 116
 		$user = $this->wordpress->get_wordpress_object_data( 'user', $user_id );
117 117
 		$this->object_insert( $user, 'user' );
118 118
 	}
119 119
 
120 120
 	/**
121
-	* Callback method for editing a user
122
-	*
123
-	* @param string $user_id
124
-	* @param object $old_user_data
125
-	*/
121
+	 * Callback method for editing a user
122
+	 *
123
+	 * @param string $user_id
124
+	 * @param object $old_user_data
125
+	 */
126 126
 	public function edit_user( $user_id, $old_user_data ) {
127 127
 		$user = $this->wordpress->get_wordpress_object_data( 'user', $user_id );
128 128
 		$this->object_update( $user, 'user' );
129 129
 	}
130 130
 
131 131
 	/**
132
-	* Callback method for deleting a user
133
-	*
134
-	* @param string $user_id
135
-	*/
132
+	 * Callback method for deleting a user
133
+	 *
134
+	 * @param string $user_id
135
+	 */
136 136
 	public function delete_user( $user_id ) {
137 137
 		$user = $this->wordpress->get_wordpress_object_data( 'user', $user_id );
138 138
 		$this->object_delete( $user, 'user' );
139 139
 	}
140 140
 
141 141
 	/**
142
-	* Callback method for posts of any type
143
-	* This can handle create, update, and delete actions
144
-	*
145
-	* @param string $post_id
146
-	* @param object $post
147
-	*/
142
+	 * Callback method for posts of any type
143
+	 * This can handle create, update, and delete actions
144
+	 *
145
+	 * @param string $post_id
146
+	 * @param object $post
147
+	 */
148 148
 	public function post_actions( $post_id, $post ) {
149 149
 
150 150
 		$post_type = $post->post_type;
@@ -191,66 +191,66 @@  discard block
 block discarded – undo
191 191
 	}
192 192
 
193 193
 	/**
194
-	* Callback method for adding an attachment
195
-	*
196
-	* @param string $post_id
197
-	*/
194
+	 * Callback method for adding an attachment
195
+	 *
196
+	 * @param string $post_id
197
+	 */
198 198
 	public function add_attachment( $post_id ) {
199 199
 		$attachment = $this->wordpress->get_wordpress_object_data( 'attachment', $post_id );
200 200
 		$this->object_insert( $attachment, 'attachment' );
201 201
 	}
202 202
 
203 203
 	/**
204
-	* Callback method for editing an attachment
205
-	*
206
-	* @param string $post_id
207
-	*/
204
+	 * Callback method for editing an attachment
205
+	 *
206
+	 * @param string $post_id
207
+	 */
208 208
 	public function edit_attachment( $post_id ) {
209 209
 		$attachment = $this->wordpress->get_wordpress_object_data( 'attachment', $post_id );
210 210
 		$this->object_update( $attachment, 'attachment' );
211 211
 	}
212 212
 
213 213
 	/**
214
-	* Callback method for editing an attachment
215
-	*
216
-	* @param string $post_id
217
-	*/
214
+	 * Callback method for editing an attachment
215
+	 *
216
+	 * @param string $post_id
217
+	 */
218 218
 	public function delete_attachment( $post_id ) {
219 219
 		$attachment = $this->wordpress->get_wordpress_object_data( 'attachment', $post_id );
220 220
 		$this->object_delete( $attachment, 'attachment' );
221 221
 	}
222 222
 
223 223
 	/**
224
-	* Callback method for adding a term
225
-	*
226
-	* @param string $term_id
227
-	* @param string $tt_id
228
-	* @param string $taxonomy
229
-	*/
224
+	 * Callback method for adding a term
225
+	 *
226
+	 * @param string $term_id
227
+	 * @param string $tt_id
228
+	 * @param string $taxonomy
229
+	 */
230 230
 	public function add_term( $term_id, $tt_id, $taxonomy ) {
231 231
 		$term = $this->wordpress->get_wordpress_object_data( $taxonomy, $term_id );
232 232
 		$this->object_insert( $term, $taxonomy );
233 233
 	}
234 234
 
235 235
 	/**
236
-	* Callback method for editing a term
237
-	*
238
-	* @param string $term_id
239
-	* @param string $taxonomy
240
-	*/
236
+	 * Callback method for editing a term
237
+	 *
238
+	 * @param string $term_id
239
+	 * @param string $taxonomy
240
+	 */
241 241
 	public function edit_term( $term_id, $taxonomy ) {
242 242
 		$term = $this->wordpress->get_wordpress_object_data( $taxonomy, $term_id );
243 243
 		$this->object_update( $term, $taxonomy );
244 244
 	}
245 245
 
246 246
 	/**
247
-	* Callback method for deleting a term
248
-	*
249
-	* @param int $term (id)
250
-	* @param int $term_taxonomy_id
251
-	* @param string $taxonomy (slug)
252
-	* @param object $deleted_term
253
-	*/
247
+	 * Callback method for deleting a term
248
+	 *
249
+	 * @param int $term (id)
250
+	 * @param int $term_taxonomy_id
251
+	 * @param string $taxonomy (slug)
252
+	 * @param object $deleted_term
253
+	 */
254 254
 	public function delete_term( $term, $tt_id, $taxonomy, $deleted_term ) {
255 255
 		$deleted_term = (array) $deleted_term;
256 256
 		$type         = $deleted_term['taxonomy'];
@@ -258,75 +258,75 @@  discard block
 block discarded – undo
258 258
 	}
259 259
 
260 260
 	/**
261
-	* Callback method for adding a comment
262
-	*
263
-	* @param string $comment_id
264
-	* @param int|string comment_approved
265
-	* @param array $commentdata
266
-	*/
261
+	 * Callback method for adding a comment
262
+	 *
263
+	 * @param string $comment_id
264
+	 * @param int|string comment_approved
265
+	 * @param array $commentdata
266
+	 */
267 267
 	public function add_comment( $comment_id, $comment_approved, $commentdata = array() ) {
268 268
 		$comment = $this->wordpress->get_wordpress_object_data( 'comment', $comment_id );
269 269
 		$this->object_insert( $comment, 'comment' );
270 270
 	}
271 271
 
272 272
 	/**
273
-	* Callback method for editing a comment
274
-	*
275
-	* @param string $comment_id
276
-	*/
273
+	 * Callback method for editing a comment
274
+	 *
275
+	 * @param string $comment_id
276
+	 */
277 277
 	public function edit_comment( $comment_id ) {
278 278
 		$comment = $this->wordpress->get_wordpress_object_data( 'comment', $comment_id );
279 279
 		$this->object_update( $comment, 'comment' );
280 280
 	}
281 281
 
282 282
 	/**
283
-	* Callback method for deleting a comment
284
-	*
285
-	* @param string $comment_id
286
-	*/
283
+	 * Callback method for deleting a comment
284
+	 *
285
+	 * @param string $comment_id
286
+	 */
287 287
 	public function delete_comment( $comment_id ) {
288 288
 		$comment = $this->wordpress->get_wordpress_object_data( 'comment', $comment_id );
289 289
 		$this->object_delete( $comment, 'comment' );
290 290
 	}
291 291
 
292 292
 	/**
293
-	* Insert a new object
294
-	* This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
295
-	*/
293
+	 * Insert a new object
294
+	 * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
295
+	 */
296 296
 	private function object_insert( $object, $type ) {
297 297
 		$this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_create );
298 298
 	}
299 299
 
300 300
 	/**
301
-	* Update an existing object
302
-	* This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
303
-	*/
301
+	 * Update an existing object
302
+	 * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
303
+	 */
304 304
 	private function object_update( $object, $type ) {
305 305
 		$this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_update );
306 306
 	}
307 307
 
308 308
 	/**
309
-	* Delete an existing object
310
-	* This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
311
-	*/
309
+	 * Delete an existing object
310
+	 * This calls the overall push crud method, which controls queuing and sending data to the Salesforce class
311
+	 */
312 312
 	private function object_delete( $object, $type ) {
313 313
 		$this->salesforce_push_object_crud( $type, $object, $this->mappings->sync_wordpress_delete );
314 314
 	}
315 315
 
316 316
 	/**
317
-	* Push objects to Salesforce.
318
-	* 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)
319
-	*
320
-	* @param string $object_type
321
-	*   Type of WordPress object.
322
-	* @param array $object
323
-	*   The WordPress data that needs to be sent to Salesforce.
324
-	* @param int $sf_sync_trigger
325
-	*   The trigger being responded to.
326
-	* @param bool $manual
327
-	*   Are we calling this manually?
328
-	*
329
-	*/
317
+	 * Push objects to Salesforce.
318
+	 * 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)
319
+	 *
320
+	 * @param string $object_type
321
+	 *   Type of WordPress object.
322
+	 * @param array $object
323
+	 *   The WordPress data that needs to be sent to Salesforce.
324
+	 * @param int $sf_sync_trigger
325
+	 *   The trigger being responded to.
326
+	 * @param bool $manual
327
+	 *   Are we calling this manually?
328
+	 *
329
+	 */
330 330
 	private function salesforce_push_object_crud( $object_type, $object, $sf_sync_trigger, $manual = false ) {
331 331
 
332 332
 		$structure       = $this->wordpress->get_wordpress_table_structure( $object_type );
@@ -451,20 +451,20 @@  discard block
 block discarded – undo
451 451
 	}
452 452
 
453 453
 	/**
454
-	* Sync WordPress objects and Salesforce objects using the REST API.
455
-	*
456
-	* @param string $object_type
457
-	*   Type of WordPress object.
458
-	* @param object $object
459
-	*   The object object.
460
-	* @param object $mapping
461
-	*   Salesforce mapping object.
462
-	* @param int $sf_sync_trigger
463
-	*   Trigger for this sync.
464
-	*
465
-	* @return true or exit the method
466
-	*
467
-	*/
454
+	 * Sync WordPress objects and Salesforce objects using the REST API.
455
+	 *
456
+	 * @param string $object_type
457
+	 *   Type of WordPress object.
458
+	 * @param object $object
459
+	 *   The object object.
460
+	 * @param object $mapping
461
+	 *   Salesforce mapping object.
462
+	 * @param int $sf_sync_trigger
463
+	 *   Trigger for this sync.
464
+	 *
465
+	 * @return true or exit the method
466
+	 *
467
+	 */
468 468
 	public function salesforce_push_sync_rest( $object_type, $object, $mapping, $sf_sync_trigger ) {
469 469
 
470 470
 		// If Salesforce is not authorized, don't do anything.
@@ -1006,21 +1006,21 @@  discard block
 block discarded – undo
1006 1006
 	}
1007 1007
 
1008 1008
 	/**
1009
-	* Create an object map between a WordPress object and a Salesforce object
1010
-	*
1011
-	* @param array $wordpress_object
1012
-	*   Array of the WordPress object's data
1013
-	* @param string $id_field_name
1014
-	*   How this object names its primary field. ie Id or comment_id or whatever
1015
-	* @param string $salesforce_id
1016
-	*   Unique identifier for the Salesforce object
1017
-	* @param array $field_mapping
1018
-	*   The row that maps the object types together, including which fields match which other fields
1019
-	*
1020
-	* @return int $wpdb->insert_id
1021
-	*   This is the database row for the map object
1022
-	*
1023
-	*/
1009
+	 * Create an object map between a WordPress object and a Salesforce object
1010
+	 *
1011
+	 * @param array $wordpress_object
1012
+	 *   Array of the WordPress object's data
1013
+	 * @param string $id_field_name
1014
+	 *   How this object names its primary field. ie Id or comment_id or whatever
1015
+	 * @param string $salesforce_id
1016
+	 *   Unique identifier for the Salesforce object
1017
+	 * @param array $field_mapping
1018
+	 *   The row that maps the object types together, including which fields match which other fields
1019
+	 *
1020
+	 * @return int $wpdb->insert_id
1021
+	 *   This is the database row for the map object
1022
+	 *
1023
+	 */
1024 1024
 	private function create_object_map( $wordpress_object, $id_field_name, $salesforce_id, $field_mapping, $pending = false ) {
1025 1025
 
1026 1026
 		if ( true === $pending ) {
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
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
 	protected $version;
19 19
 
20 20
 	/**
21
-	* Constructor which sets up deactivate hooks
22
-	* @param object $wpdb
23
-	* @param string $version
24
-	* @param string $slug
25
-	* @param array $schedulable_classes
26
-	*
27
-	*/
21
+	 * Constructor which sets up deactivate hooks
22
+	 * @param object $wpdb
23
+	 * @param string $version
24
+	 * @param string $slug
25
+	 * @param array $schedulable_classes
26
+	 *
27
+	 */
28 28
 	public function __construct( $wpdb, $version, $slug, $schedulable_classes ) {
29 29
 		$this->wpdb                = $wpdb;
30 30
 		$this->version             = $version;
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	}
43 43
 
44 44
 	/**
45
-	* Drop database tables for Salesforce
46
-	* This removes the tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
47
-	*
48
-	*/
45
+	 * Drop database tables for Salesforce
46
+	 * This removes the tables for fieldmaps (between types of objects) and object maps (between indidual instances of objects)
47
+	 *
48
+	 */
49 49
 	public function wordpress_salesforce_drop_tables() {
50 50
 		$field_map_table  = $this->wpdb->prefix . 'object_sync_sf_field_map';
51 51
 		$object_map_table = $this->wpdb->prefix . 'object_sync_sf_object_map';
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Clear the scheduled tasks
59
-	* This removes all the scheduled tasks that are included in the plugin's $schedulable_classes array
60
-	*
61
-	*/
58
+	 * Clear the scheduled tasks
59
+	 * This removes all the scheduled tasks that are included in the plugin's $schedulable_classes array
60
+	 *
61
+	 */
62 62
 	public function clear_schedule() {
63 63
 		foreach ( $this->schedulable_classes as $key => $value ) {
64 64
 			wp_clear_scheduled_hook( $key );
@@ -66,21 +66,21 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	/**
69
-	* Delete the log post type
70
-	* This removes the log post type
71
-	*
72
-	*/
69
+	 * Delete the log post type
70
+	 * This removes the log post type
71
+	 *
72
+	 */
73 73
 	public function delete_log_post_type() {
74 74
 		unregister_post_type( 'wp_log' );
75 75
 	}
76 76
 
77 77
 	/**
78
-	* Remove roles and capabilities
79
-	* This removes the configure_salesforce capability from the admin role
80
-	*
81
-	* It also allows other plugins to remove the capability from other roles
82
-	*
83
-	*/
78
+	 * Remove roles and capabilities
79
+	 * This removes the configure_salesforce capability from the admin role
80
+	 *
81
+	 * It also allows other plugins to remove the capability from other roles
82
+	 *
83
+	 */
84 84
 	public function remove_roles_capabilities() {
85 85
 
86 86
 		// by default, only administrators can configure the plugin
@@ -100,18 +100,18 @@  discard block
 block discarded – undo
100 100
 	}
101 101
 
102 102
 	/**
103
-	* Flush the plugin cache
104
-	*
105
-	*/
103
+	 * Flush the plugin cache
104
+	 *
105
+	 */
106 106
 	public function flush_plugin_cache() {
107 107
 		$sfwp_transients = new Object_Sync_Sf_WordPress_Transient( 'sfwp_transients' );
108 108
 		$sfwp_transients->flush();
109 109
 	}
110 110
 
111 111
 	/**
112
-	* Clear the plugin options
113
-	*
114
-	*/
112
+	 * Clear the plugin options
113
+	 *
114
+	 */
115 115
 	public function delete_plugin_options() {
116 116
 		$table          = $this->wpdb->prefix . 'options';
117 117
 		$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/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
 
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
 	}
60 60
 
61 61
 	/**
62
-	* Create the filters we need to run
63
-	*
64
-	*/
62
+	 * Create the filters we need to run
63
+	 *
64
+	 */
65 65
 	public function add_filters() {
66 66
 		add_filter( 'cron_schedules', array( $this, 'set_schedule_frequency' ) );
67 67
 	}
68 68
 
69 69
 	/**
70
-	* Convert the schedule frequency from the admin settings into an array
71
-	* interval must be in seconds for the class to use it
72
-	*
73
-	*/
70
+	 * Convert the schedule frequency from the admin settings into an array
71
+	 * interval must be in seconds for the class to use it
72
+	 *
73
+	 */
74 74
 	public function set_schedule_frequency( $schedules ) {
75 75
 
76 76
 		// create an option in the core schedules array for each one the plugin defines
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 	}
109 109
 
110 110
 	/**
111
-	* Convert the schedule frequency from the admin settings into an array
112
-	* interval must be in seconds for the class to use it
113
-	*
114
-	*/
111
+	 * Convert the schedule frequency from the admin settings into an array
112
+	 * interval must be in seconds for the class to use it
113
+	 *
114
+	 */
115 115
 	public function get_schedule_frequency_key( $name = '' ) {
116 116
 
117 117
 		$schedule_number = get_option( 'object_sync_for_salesforce_' . $name . '_schedule_number', '' );
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 	}
139 139
 
140 140
 	/**
141
-	* Convert the schedule frequency from the admin settings into seconds
142
-	*
143
-	*/
141
+	 * Convert the schedule frequency from the admin settings into seconds
142
+	 *
143
+	 */
144 144
 	public function get_schedule_frequency_seconds( $name = '' ) {
145 145
 
146 146
 		$schedule_number = get_option( 'object_sync_for_salesforce_' . $name . '_schedule_number', '' );
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/salesforce.php 1 patch
Indentation   +406 added lines, -406 removed lines patch added patch discarded remove patch
@@ -17,31 +17,31 @@  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 object $logging
41
-	*   Logging object for this plugin.
42
-	* @param array $schedulable_classes
43
-	*   array of classes that can have scheduled tasks specific to them
44
-	*/
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 object $logging
41
+	 *   Logging object for this plugin.
42
+	 * @param array $schedulable_classes
43
+	 *   array of classes that can have scheduled tasks specific to them
44
+	 */
45 45
 	public function __construct( $consumer_key, $consumer_secret, $login_url, $callback_url, $authorize_path, $token_path, $rest_api_version, $wordpress, $slug, $logging, $schedulable_classes ) {
46 46
 		$this->consumer_key        = $consumer_key;
47 47
 		$this->consumer_secret     = $consumer_secret;
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 	}
71 71
 
72 72
 	/**
73
-	* Converts a 15-character case-sensitive Salesforce ID to 18-character
74
-	* case-insensitive ID. If input is not 15-characters, return input unaltered.
75
-	*
76
-	* @param string $sf_id_15
77
-	*   15-character case-sensitive Salesforce ID
78
-	* @return string
79
-	*   18-character case-insensitive Salesforce ID
80
-	*/
73
+	 * Converts a 15-character case-sensitive Salesforce ID to 18-character
74
+	 * case-insensitive ID. If input is not 15-characters, return input unaltered.
75
+	 *
76
+	 * @param string $sf_id_15
77
+	 *   15-character case-sensitive Salesforce ID
78
+	 * @return string
79
+	 *   18-character case-insensitive Salesforce ID
80
+	 */
81 81
 	public static function convert_id( $sf_id_15 ) {
82 82
 		if ( strlen( $sf_id_15 ) !== 15 ) {
83 83
 			return $sf_id_15;
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 
99 99
 	/**
100
-	* Given a Salesforce ID, return the corresponding SObject name. (Based on
101
-	*  keyPrefix from object definition, @see
102
-	*  https://developer.salesforce.com/forums/?id=906F0000000901ZIAQ )
103
-	*
104
-	* @param string $sf_id
105
-	*   15- or 18-character Salesforce ID
106
-	* @return string
107
-	*   sObject name, e.g. "Account", "Contact", "my__Custom_Object__c" or FALSE
108
-	*   if no match could be found.
109
-	* @throws Object_Sync_Sf_Exception
110
-	*/
100
+	 * Given a Salesforce ID, return the corresponding SObject name. (Based on
101
+	 *  keyPrefix from object definition, @see
102
+	 *  https://developer.salesforce.com/forums/?id=906F0000000901ZIAQ )
103
+	 *
104
+	 * @param string $sf_id
105
+	 *   15- or 18-character Salesforce ID
106
+	 * @return string
107
+	 *   sObject name, e.g. "Account", "Contact", "my__Custom_Object__c" or FALSE
108
+	 *   if no match could be found.
109
+	 * @throws Object_Sync_Sf_Exception
110
+	 */
111 111
 	public function get_sobject_type( $sf_id ) {
112 112
 		$objects = $this->objects(
113 113
 			array(
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	}
125 125
 
126 126
 	/**
127
-	* Determine if this SF instance is fully configured.
128
-	*
129
-	*/
127
+	 * Determine if this SF instance is fully configured.
128
+	 *
129
+	 */
130 130
 	public function is_authorized() {
131 131
 		return ! empty( $this->consumer_key ) && ! empty( $this->consumer_secret ) && $this->get_refresh_token();
132 132
 	}
133 133
 
134 134
 	/**
135
-	* Get REST API versions available on this Salesforce organization
136
-	* This is not an authenticated call, so it would not be a helpful test
137
-	*/
135
+	 * Get REST API versions available on this Salesforce organization
136
+	 * This is not an authenticated call, so it would not be a helpful test
137
+	 */
138 138
 	public function get_api_versions() {
139 139
 		$options = array(
140 140
 			'authenticated' => false,
@@ -144,26 +144,26 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 
146 146
 	/**
147
-	* Make a call to the Salesforce REST API.
148
-	*
149
-	* @param string $path
150
-	*   Path to resource.
151
-	* @param array $params
152
-	*   Parameters to provide.
153
-	* @param string $method
154
-	*   Method to initiate the call, such as GET or POST. Defaults to GET.
155
-	* @param array $options
156
-	*   Any method can supply options for the API call, and they'll be preserved as far as the curl request
157
-	*   They get merged with the class options
158
-	* @param string $type
159
-	*   Type of call. Defaults to 'rest' - currently we don't support other types.
160
-	*   Other exammple in Drupal is 'apexrest'
161
-	*
162
-	* @return mixed
163
-	*   The requested response.
164
-	*
165
-	* @throws Object_Sync_Sf_Exception
166
-	*/
147
+	 * Make a call to the Salesforce REST API.
148
+	 *
149
+	 * @param string $path
150
+	 *   Path to resource.
151
+	 * @param array $params
152
+	 *   Parameters to provide.
153
+	 * @param string $method
154
+	 *   Method to initiate the call, such as GET or POST. Defaults to GET.
155
+	 * @param array $options
156
+	 *   Any method can supply options for the API call, and they'll be preserved as far as the curl request
157
+	 *   They get merged with the class options
158
+	 * @param string $type
159
+	 *   Type of call. Defaults to 'rest' - currently we don't support other types.
160
+	 *   Other exammple in Drupal is 'apexrest'
161
+	 *
162
+	 * @return mixed
163
+	 *   The requested response.
164
+	 *
165
+	 * @throws Object_Sync_Sf_Exception
166
+	 */
167 167
 	public function api_call( $path, $params = array(), $method = 'GET', $options = array(), $type = 'rest' ) {
168 168
 		if ( ! $this->get_access_token() ) {
169 169
 			$this->refresh_token();
@@ -214,25 +214,25 @@  discard block
 block discarded – undo
214 214
 	}
215 215
 
216 216
 	/**
217
-	* Private helper to issue an SF API request.
218
-	* This method is the only place where we read to or write from the cache
219
-	*
220
-	* @param string $path
221
-	*   Path to resource.
222
-	* @param array $params
223
-	*   Parameters to provide.
224
-	* @param string $method
225
-	*   Method to initiate the call, such as GET or POST.  Defaults to GET.
226
-	* @param array $options
227
-	*   This is the options array from the api_call method
228
-	*   This is where it gets merged with $this->options
229
-	* @param string $type
230
-	*   Type of call. Defaults to 'rest' - currently we don't support other types
231
-	*   Other exammple in Drupal is 'apexrest'
232
-	*
233
-	* @return array
234
-	*   The requested data.
235
-	*/
217
+	 * Private helper to issue an SF API request.
218
+	 * This method is the only place where we read to or write from the cache
219
+	 *
220
+	 * @param string $path
221
+	 *   Path to resource.
222
+	 * @param array $params
223
+	 *   Parameters to provide.
224
+	 * @param string $method
225
+	 *   Method to initiate the call, such as GET or POST.  Defaults to GET.
226
+	 * @param array $options
227
+	 *   This is the options array from the api_call method
228
+	 *   This is where it gets merged with $this->options
229
+	 * @param string $type
230
+	 *   Type of call. Defaults to 'rest' - currently we don't support other types
231
+	 *   Other exammple in Drupal is 'apexrest'
232
+	 *
233
+	 * @return array
234
+	 *   The requested data.
235
+	 */
236 236
 	protected function api_http_request( $path, $params, $method, $options = array(), $type = 'rest' ) {
237 237
 		$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
238 238
 		$url     = $this->get_api_endpoint( $type ) . $path;
@@ -310,22 +310,22 @@  discard block
 block discarded – undo
310 310
 	}
311 311
 
312 312
 	/**
313
-	* Make the HTTP request. Wrapper around curl().
314
-	*
315
-	* @param string $url
316
-	*   Path to make request from.
317
-	* @param array $data
318
-	*   The request body.
319
-	* @param array $headers
320
-	*   Request headers to send as name => value.
321
-	* @param string $method
322
-	*   Method to initiate the call, such as GET or POST. Defaults to GET.
323
-	* @param array $options
324
-	*   This is the options array from the api_http_request method
325
-	*
326
-	* @return array
327
-	*   Salesforce response object.
328
-	*/
313
+	 * Make the HTTP request. Wrapper around curl().
314
+	 *
315
+	 * @param string $url
316
+	 *   Path to make request from.
317
+	 * @param array $data
318
+	 *   The request body.
319
+	 * @param array $headers
320
+	 *   Request headers to send as name => value.
321
+	 * @param string $method
322
+	 *   Method to initiate the call, such as GET or POST. Defaults to GET.
323
+	 * @param array $options
324
+	 *   This is the options array from the api_http_request method
325
+	 *
326
+	 * @return array
327
+	 *   Salesforce response object.
328
+	 */
329 329
 	protected function http_request( $url, $data, $headers = array(), $method = 'GET', $options = array() ) {
330 330
 		// Build the request, including path and headers. Internal use.
331 331
 
@@ -460,14 +460,14 @@  discard block
 block discarded – undo
460 460
 	}
461 461
 
462 462
 	/**
463
-	* Get the API end point for a given type of the API.
464
-	*
465
-	* @param string $api_type
466
-	*   E.g., rest, partner, enterprise.
467
-	*
468
-	* @return string
469
-	*   Complete URL endpoint for API access.
470
-	*/
463
+	 * Get the API end point for a given type of the API.
464
+	 *
465
+	 * @param string $api_type
466
+	 *   E.g., rest, partner, enterprise.
467
+	 *
468
+	 * @return string
469
+	 *   Complete URL endpoint for API access.
470
+	 */
471 471
 	public function get_api_endpoint( $api_type = 'rest' ) {
472 472
 		// Special handling for apexrest, since it's not in the identity object.
473 473
 		if ( 'apexrest' === $api_type ) {
@@ -483,67 +483,67 @@  discard block
 block discarded – undo
483 483
 	}
484 484
 
485 485
 	/**
486
-	* Get the SF instance URL. Useful for linking to objects.
487
-	*/
486
+	 * Get the SF instance URL. Useful for linking to objects.
487
+	 */
488 488
 	public function get_instance_url() {
489 489
 		return get_option( 'object_sync_for_salesforce_instance_url', '' );
490 490
 	}
491 491
 
492 492
 	/**
493
-	* Set the SF instanc URL.
494
-	*
495
-	* @param string $url
496
-	*   URL to set.
497
-	*/
493
+	 * Set the SF instanc URL.
494
+	 *
495
+	 * @param string $url
496
+	 *   URL to set.
497
+	 */
498 498
 	protected function set_instance_url( $url ) {
499 499
 		update_option( 'object_sync_for_salesforce_instance_url', $url );
500 500
 	}
501 501
 
502 502
 	/**
503
-	* Get the access token.
504
-	*/
503
+	 * Get the access token.
504
+	 */
505 505
 	public function get_access_token() {
506 506
 		return get_option( 'object_sync_for_salesforce_access_token', '' );
507 507
 	}
508 508
 
509 509
 	/**
510
-	* Set the access token.
511
-	*
512
-	* It is stored in session.
513
-	*
514
-	* @param string $token
515
-	*   Access token from Salesforce.
516
-	*/
510
+	 * Set the access token.
511
+	 *
512
+	 * It is stored in session.
513
+	 *
514
+	 * @param string $token
515
+	 *   Access token from Salesforce.
516
+	 */
517 517
 	protected function set_access_token( $token ) {
518 518
 		update_option( 'object_sync_for_salesforce_access_token', $token );
519 519
 	}
520 520
 
521 521
 	/**
522
-	* Get refresh token.
523
-	*/
522
+	 * Get refresh token.
523
+	 */
524 524
 	protected function get_refresh_token() {
525 525
 		return get_option( 'object_sync_for_salesforce_refresh_token', '' );
526 526
 	}
527 527
 
528 528
 	/**
529
-	* Set refresh token.
530
-	*
531
-	* @param string $token
532
-	*   Refresh token from Salesforce.
533
-	*/
529
+	 * Set refresh token.
530
+	 *
531
+	 * @param string $token
532
+	 *   Refresh token from Salesforce.
533
+	 */
534 534
 	protected function set_refresh_token( $token ) {
535 535
 		update_option( 'object_sync_for_salesforce_refresh_token', $token );
536 536
 	}
537 537
 
538 538
 	/**
539
-	* Refresh access token based on the refresh token. Updates session variable.
540
-	*
541
-	* todo: figure out how to do this as part of the schedule class
542
-	* 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.
543
-	* but it could be a performance boost to do it at scheduleable intervals instead.
544
-	*
545
-	* @throws Object_Sync_Sf_Exception
546
-	*/
539
+	 * Refresh access token based on the refresh token. Updates session variable.
540
+	 *
541
+	 * todo: figure out how to do this as part of the schedule class
542
+	 * 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.
543
+	 * but it could be a performance boost to do it at scheduleable intervals instead.
544
+	 *
545
+	 * @throws Object_Sync_Sf_Exception
546
+	 */
547 547
 	protected function refresh_token() {
548 548
 		$refresh_token = $this->get_refresh_token();
549 549
 		if ( empty( $refresh_token ) ) {
@@ -590,13 +590,13 @@  discard block
 block discarded – undo
590 590
 	}
591 591
 
592 592
 	/**
593
-	* Retrieve and store the Salesforce identity given an ID url.
594
-	*
595
-	* @param string $id
596
-	*   Identity URL.
597
-	*
598
-	* @throws Object_Sync_Sf_Exception
599
-	*/
593
+	 * Retrieve and store the Salesforce identity given an ID url.
594
+	 *
595
+	 * @param string $id
596
+	 *   Identity URL.
597
+	 *
598
+	 * @throws Object_Sync_Sf_Exception
599
+	 */
600 600
 	protected function set_identity( $id ) {
601 601
 		$headers  = array(
602 602
 			'Authorization'   => 'Authorization: OAuth ' . $this->get_access_token(),
@@ -612,18 +612,18 @@  discard block
 block discarded – undo
612 612
 	}
613 613
 
614 614
 	/**
615
-	* Return the Salesforce identity, which is stored in a variable.
616
-	*
617
-	* @return array
618
-	*   Returns FALSE if no identity has been stored.
619
-	*/
615
+	 * Return the Salesforce identity, which is stored in a variable.
616
+	 *
617
+	 * @return array
618
+	 *   Returns FALSE if no identity has been stored.
619
+	 */
620 620
 	public function get_identity() {
621 621
 		return get_option( 'object_sync_for_salesforce_identity', false );
622 622
 	}
623 623
 
624 624
 	/**
625
-	* OAuth step 1: Redirect to Salesforce and request and authorization code.
626
-	*/
625
+	 * OAuth step 1: Redirect to Salesforce and request and authorization code.
626
+	 */
627 627
 	public function get_authorization_code() {
628 628
 		$url = add_query_arg(
629 629
 			array(
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
 	}
638 638
 
639 639
 	/**
640
-	* OAuth step 2: Exchange an authorization code for an access token.
641
-	*
642
-	* @param string $code
643
-	*   Code from Salesforce.
644
-	*/
640
+	 * OAuth step 2: Exchange an authorization code for an access token.
641
+	 *
642
+	 * @param string $code
643
+	 *   Code from Salesforce.
644
+	 */
645 645
 	public function request_token( $code ) {
646 646
 		$data = array(
647 647
 			'code'          => $code,
@@ -686,22 +686,22 @@  discard block
 block discarded – undo
686 686
 	/* Core API calls */
687 687
 
688 688
 	/**
689
-	* Available objects and their metadata for your organization's data.
690
-	*
691
-	* @param array $conditions
692
-	*   Associative array of filters to apply to the returned objects. Filters
693
-	*   are applied after the list is returned from Salesforce.
694
-	* @param bool $reset
695
-	*   Whether to reset the cache and retrieve a fresh version from Salesforce.
696
-	*
697
-	* @return array
698
-	*   Available objects and metadata.
699
-	*
700
-	* part of core API calls. this call does require authentication, and the basic url it becomes is like this:
701
-	* https://instance.salesforce.com/services/data/v#.0/sobjects
702
-	*
703
-	* updateable is really how the api spells it
704
-	*/
689
+	 * Available objects and their metadata for your organization's data.
690
+	 *
691
+	 * @param array $conditions
692
+	 *   Associative array of filters to apply to the returned objects. Filters
693
+	 *   are applied after the list is returned from Salesforce.
694
+	 * @param bool $reset
695
+	 *   Whether to reset the cache and retrieve a fresh version from Salesforce.
696
+	 *
697
+	 * @return array
698
+	 *   Available objects and metadata.
699
+	 *
700
+	 * part of core API calls. this call does require authentication, and the basic url it becomes is like this:
701
+	 * https://instance.salesforce.com/services/data/v#.0/sobjects
702
+	 *
703
+	 * updateable is really how the api spells it
704
+	 */
705 705
 	public function objects(
706 706
 		$conditions = array(
707 707
 			'updateable'  => true,
@@ -731,22 +731,22 @@  discard block
 block discarded – undo
731 731
 	}
732 732
 
733 733
 	/**
734
-	* Use SOQL to get objects based on query string.
735
-	*
736
-	* @param string $query
737
-	*   The SOQL query.
738
-	* @param array $options
739
-	*   Allow for the query to have options based on what the user needs from it, ie caching, read/write, etc.
740
-	* @param boolean $all
741
-	*   Whether this should get all results for the query
742
-	* @param boolean $explain
743
-	*   If set, Salesforce will return feedback on the query performance
744
-	*
745
-	* @return array
746
-	*   Array of Salesforce objects that match the query.
747
-	*
748
-	* part of core API calls
749
-	*/
734
+	 * Use SOQL to get objects based on query string.
735
+	 *
736
+	 * @param string $query
737
+	 *   The SOQL query.
738
+	 * @param array $options
739
+	 *   Allow for the query to have options based on what the user needs from it, ie caching, read/write, etc.
740
+	 * @param boolean $all
741
+	 *   Whether this should get all results for the query
742
+	 * @param boolean $explain
743
+	 *   If set, Salesforce will return feedback on the query performance
744
+	 *
745
+	 * @return array
746
+	 *   Array of Salesforce objects that match the query.
747
+	 *
748
+	 * part of core API calls
749
+	 */
750 750
 	public function query( $query, $options = array(), $all = false, $explain = false ) {
751 751
 		$search_data = [
752 752
 			'q' => (string) $query,
@@ -766,19 +766,19 @@  discard block
 block discarded – undo
766 766
 	}
767 767
 
768 768
 	/**
769
-	* Retrieve all the metadata for an object.
770
-	*
771
-	* @param string $name
772
-	*   Object type name, E.g., Contact, Account, etc.
773
-	* @param bool $reset
774
-	*   Whether to reset the cache and retrieve a fresh version from Salesforce.
775
-	*
776
-	* @return array
777
-	*   All the metadata for an object, including information about each field,
778
-	*   URLs, and child relationships.
779
-	*
780
-	* part of core API calls
781
-	*/
769
+	 * Retrieve all the metadata for an object.
770
+	 *
771
+	 * @param string $name
772
+	 *   Object type name, E.g., Contact, Account, etc.
773
+	 * @param bool $reset
774
+	 *   Whether to reset the cache and retrieve a fresh version from Salesforce.
775
+	 *
776
+	 * @return array
777
+	 *   All the metadata for an object, including information about each field,
778
+	 *   URLs, and child relationships.
779
+	 *
780
+	 * part of core API calls
781
+	 */
782 782
 	public function object_describe( $name, $reset = false ) {
783 783
 		if ( empty( $name ) ) {
784 784
 			return array();
@@ -806,26 +806,26 @@  discard block
 block discarded – undo
806 806
 	}
807 807
 
808 808
 	/**
809
-	* Create a new object of the given type.
810
-	*
811
-	* @param string $name
812
-	*   Object type name, E.g., Contact, Account, etc.
813
-	* @param array $params
814
-	*   Values of the fields to set for the object.
815
-	*
816
-	* @return array
817
-	*   json: {"id":"00190000001pPvHAAU","success":true,"errors":[]}
818
-	*   code: 201
819
-	*   data:
820
-	*     "id" : "00190000001pPvHAAU",
821
-	*     "success" : true
822
-	*     "errors" : [ ],
823
-	*   from_cache:
824
-	*   cached:
825
-	*   is_redo:
826
-	*
827
-	* part of core API calls
828
-	*/
809
+	 * Create a new object of the given type.
810
+	 *
811
+	 * @param string $name
812
+	 *   Object type name, E.g., Contact, Account, etc.
813
+	 * @param array $params
814
+	 *   Values of the fields to set for the object.
815
+	 *
816
+	 * @return array
817
+	 *   json: {"id":"00190000001pPvHAAU","success":true,"errors":[]}
818
+	 *   code: 201
819
+	 *   data:
820
+	 *     "id" : "00190000001pPvHAAU",
821
+	 *     "success" : true
822
+	 *     "errors" : [ ],
823
+	 *   from_cache:
824
+	 *   cached:
825
+	 *   is_redo:
826
+	 *
827
+	 * part of core API calls
828
+	 */
829 829
 	public function object_create( $name, $params ) {
830 830
 		$options = array(
831 831
 			'type' => 'write',
@@ -835,34 +835,34 @@  discard block
 block discarded – undo
835 835
 	}
836 836
 
837 837
 	/**
838
-	* Create new records or update existing records.
839
-	*
840
-	* The new records or updated records are based on the value of the specified
841
-	* field.  If the value is not unique, REST API returns a 300 response with
842
-	* the list of matching records.
843
-	*
844
-	* @param string $name
845
-	*   Object type name, E.g., Contact, Account.
846
-	* @param string $key
847
-	*   The field to check if this record should be created or updated.
848
-	* @param string $value
849
-	*   The value for this record of the field specified for $key.
850
-	* @param array $params
851
-	*   Values of the fields to set for the object.
852
-	*
853
-	* @return array
854
-	*   json: {"id":"00190000001pPvHAAU","success":true,"errors":[]}
855
-	*   code: 201
856
-	*   data:
857
-	*     "id" : "00190000001pPvHAAU",
858
-	*     "success" : true
859
-	*     "errors" : [ ],
860
-	*   from_cache:
861
-	*   cached:
862
-	*   is_redo:
863
-	*
864
-	* part of core API calls
865
-	*/
838
+	 * Create new records or update existing records.
839
+	 *
840
+	 * The new records or updated records are based on the value of the specified
841
+	 * field.  If the value is not unique, REST API returns a 300 response with
842
+	 * the list of matching records.
843
+	 *
844
+	 * @param string $name
845
+	 *   Object type name, E.g., Contact, Account.
846
+	 * @param string $key
847
+	 *   The field to check if this record should be created or updated.
848
+	 * @param string $value
849
+	 *   The value for this record of the field specified for $key.
850
+	 * @param array $params
851
+	 *   Values of the fields to set for the object.
852
+	 *
853
+	 * @return array
854
+	 *   json: {"id":"00190000001pPvHAAU","success":true,"errors":[]}
855
+	 *   code: 201
856
+	 *   data:
857
+	 *     "id" : "00190000001pPvHAAU",
858
+	 *     "success" : true
859
+	 *     "errors" : [ ],
860
+	 *   from_cache:
861
+	 *   cached:
862
+	 *   is_redo:
863
+	 *
864
+	 * part of core API calls
865
+	 */
866 866
 	public function object_upsert( $name, $key, $value, $params ) {
867 867
 		$options = array(
868 868
 			'type' => 'write',
@@ -884,27 +884,27 @@  discard block
 block discarded – undo
884 884
 	}
885 885
 
886 886
 	/**
887
-	* Update an existing object.
888
-	*
889
-	* @param string $name
890
-	*   Object type name, E.g., Contact, Account.
891
-	* @param string $id
892
-	*   Salesforce id of the object.
893
-	* @param array $params
894
-	*   Values of the fields to set for the object.
895
-	*
896
-	* part of core API calls
897
-	*
898
-	* @return array
899
-	*   json: {"success":true,"body":""}
900
-	*   code: 204
901
-	*   data:
887
+	 * Update an existing object.
888
+	 *
889
+	 * @param string $name
890
+	 *   Object type name, E.g., Contact, Account.
891
+	 * @param string $id
892
+	 *   Salesforce id of the object.
893
+	 * @param array $params
894
+	 *   Values of the fields to set for the object.
895
+	 *
896
+	 * part of core API calls
897
+	 *
898
+	 * @return array
899
+	 *   json: {"success":true,"body":""}
900
+	 *   code: 204
901
+	 *   data:
902 902
 		success: 1
903 903
 		body:
904
-	*   from_cache:
905
-	*   cached:
906
-	*   is_redo:
907
-	*/
904
+	 *   from_cache:
905
+	 *   cached:
906
+	 *   is_redo:
907
+	 */
908 908
 	public function object_update( $name, $id, $params ) {
909 909
 		$options = array(
910 910
 			'type' => 'write',
@@ -914,62 +914,62 @@  discard block
 block discarded – undo
914 914
 	}
915 915
 
916 916
 	/**
917
-	* Return a full loaded Salesforce object.
918
-	*
919
-	* @param string $name
920
-	*   Object type name, E.g., Contact, Account.
921
-	* @param string $id
922
-	*   Salesforce id of the object.
923
-	*
924
-	* @return object
925
-	*   Object of the requested Salesforce object.
926
-	*
927
-	* part of core API calls
928
-	*/
917
+	 * Return a full loaded Salesforce object.
918
+	 *
919
+	 * @param string $name
920
+	 *   Object type name, E.g., Contact, Account.
921
+	 * @param string $id
922
+	 *   Salesforce id of the object.
923
+	 *
924
+	 * @return object
925
+	 *   Object of the requested Salesforce object.
926
+	 *
927
+	 * part of core API calls
928
+	 */
929 929
 	public function object_read( $name, $id ) {
930 930
 		return $this->api_call( "sobjects/{$name}/{$id}", array(), 'GET' );
931 931
 	}
932 932
 
933 933
 	/**
934
-	* Make a call to the Analytics API
935
-	*
936
-	* @param string $name
937
-	*   Object type name, E.g., Report
938
-	* @param string $id
939
-	*   Salesforce id of the object.
940
-	* @param string $route
941
-	*   What comes after the ID? E.g. instances, ?includeDetails=True
942
-	* @param array $params
943
-	*   Params to put with the request
944
-	* @param string $method
945
-	*   GET or POST
946
-	*
947
-	* @return object
948
-	*   Object of the requested Salesforce object.
949
-	*
950
-	* part of core API calls
951
-	*/
934
+	 * Make a call to the Analytics API
935
+	 *
936
+	 * @param string $name
937
+	 *   Object type name, E.g., Report
938
+	 * @param string $id
939
+	 *   Salesforce id of the object.
940
+	 * @param string $route
941
+	 *   What comes after the ID? E.g. instances, ?includeDetails=True
942
+	 * @param array $params
943
+	 *   Params to put with the request
944
+	 * @param string $method
945
+	 *   GET or POST
946
+	 *
947
+	 * @return object
948
+	 *   Object of the requested Salesforce object.
949
+	 *
950
+	 * part of core API calls
951
+	 */
952 952
 	public function analytics_api( $name, $id, $route = '', $params = array(), $method = 'GET' ) {
953 953
 		return $this->api_call( "analytics/{$name}/{$id}/{$route}", $params, $method );
954 954
 	}
955 955
 
956 956
 	/**
957
-	* Run a specific Analytics report
958
-	*
959
-	* @param string $id
960
-	*   Salesforce id of the object.
961
-	* @param bool $async
962
-	*   Whether the report is asynchronous
963
-	* @param array $params
964
-	*   Params to put with the request
965
-	* @param string $method
966
-	*   GET or POST
967
-	*
968
-	* @return object
969
-	*   Object of the requested Salesforce object.
970
-	*
971
-	* part of core API calls
972
-	*/
957
+	 * Run a specific Analytics report
958
+	 *
959
+	 * @param string $id
960
+	 *   Salesforce id of the object.
961
+	 * @param bool $async
962
+	 *   Whether the report is asynchronous
963
+	 * @param array $params
964
+	 *   Params to put with the request
965
+	 * @param string $method
966
+	 *   GET or POST
967
+	 *
968
+	 * @return object
969
+	 *   Object of the requested Salesforce object.
970
+	 *
971
+	 * part of core API calls
972
+	 */
973 973
 	public function run_analytics_report( $id, $async = true, $clear_cache = false, $params = array(), $method = 'GET', $report_cache_expiration = '', $cache_instance = true, $instance_cache_expiration = '' ) {
974 974
 
975 975
 		$id         = $this->convert_id( $id );
@@ -1055,36 +1055,36 @@  discard block
 block discarded – undo
1055 1055
 	}
1056 1056
 
1057 1057
 	/**
1058
-	* Return a full loaded Salesforce object from External ID.
1059
-	*
1060
-	* @param string $name
1061
-	*   Object type name, E.g., Contact, Account.
1062
-	* @param string $field
1063
-	*   Salesforce external id field name.
1064
-	* @param string $value
1065
-	*   Value of external id.
1066
-	*
1067
-	* @return object
1068
-	*   Object of the requested Salesforce object.
1069
-	*
1070
-	* part of core API calls
1071
-	*/
1058
+	 * Return a full loaded Salesforce object from External ID.
1059
+	 *
1060
+	 * @param string $name
1061
+	 *   Object type name, E.g., Contact, Account.
1062
+	 * @param string $field
1063
+	 *   Salesforce external id field name.
1064
+	 * @param string $value
1065
+	 *   Value of external id.
1066
+	 *
1067
+	 * @return object
1068
+	 *   Object of the requested Salesforce object.
1069
+	 *
1070
+	 * part of core API calls
1071
+	 */
1072 1072
 	public function object_readby_external_id( $name, $field, $value ) {
1073 1073
 		return $this->api_call( "sobjects/{$name}/{$field}/{$value}" );
1074 1074
 	}
1075 1075
 
1076 1076
 	/**
1077
-	* Delete a Salesforce object.
1078
-	*
1079
-	* @param string $name
1080
-	*   Object type name, E.g., Contact, Account.
1081
-	* @param string $id
1082
-	*   Salesforce id of the object.
1083
-	*
1084
-	* @return array
1085
-	*
1086
-	* part of core API calls
1087
-	*/
1077
+	 * Delete a Salesforce object.
1078
+	 *
1079
+	 * @param string $name
1080
+	 *   Object type name, E.g., Contact, Account.
1081
+	 * @param string $id
1082
+	 *   Salesforce id of the object.
1083
+	 *
1084
+	 * @return array
1085
+	 *
1086
+	 * part of core API calls
1087
+	 */
1088 1088
 	public function object_delete( $name, $id ) {
1089 1089
 		$options = array(
1090 1090
 			'type' => 'write',
@@ -1094,17 +1094,17 @@  discard block
 block discarded – undo
1094 1094
 	}
1095 1095
 
1096 1096
 	/**
1097
-	* Retrieves the list of individual objects that have been deleted within the
1098
-	* given timespan for a specified object type.
1099
-	*
1100
-	* @param string $type
1101
-	*   Object type name, E.g., Contact, Account.
1102
-	* @param string $startDate
1103
-	*   Start date to check for deleted objects (in ISO 8601 format).
1104
-	* @param string $endDate
1105
-	*   End date to check for deleted objects (in ISO 8601 format).
1106
-	* @return GetDeletedResult
1107
-	*/
1097
+	 * Retrieves the list of individual objects that have been deleted within the
1098
+	 * given timespan for a specified object type.
1099
+	 *
1100
+	 * @param string $type
1101
+	 *   Object type name, E.g., Contact, Account.
1102
+	 * @param string $startDate
1103
+	 *   Start date to check for deleted objects (in ISO 8601 format).
1104
+	 * @param string $endDate
1105
+	 *   End date to check for deleted objects (in ISO 8601 format).
1106
+	 * @return GetDeletedResult
1107
+	 */
1108 1108
 	public function get_deleted( $type, $start_date, $end_date ) {
1109 1109
 		$options = array(
1110 1110
 			'cache' => false,
@@ -1114,13 +1114,13 @@  discard block
 block discarded – undo
1114 1114
 
1115 1115
 
1116 1116
 	/**
1117
-	* Return a list of available resources for the configured API version.
1118
-	*
1119
-	* @return array
1120
-	*   Associative array keyed by name with a URI value.
1121
-	*
1122
-	* part of core API calls
1123
-	*/
1117
+	 * Return a list of available resources for the configured API version.
1118
+	 *
1119
+	 * @return array
1120
+	 *   Associative array keyed by name with a URI value.
1121
+	 *
1122
+	 * part of core API calls
1123
+	 */
1124 1124
 	public function list_resources() {
1125 1125
 		$resources = $this->api_call( '' );
1126 1126
 		foreach ( $resources as $key => $path ) {
@@ -1130,31 +1130,31 @@  discard block
 block discarded – undo
1130 1130
 	}
1131 1131
 
1132 1132
 	/**
1133
-	* Return a list of SFIDs for the given object, which have been created or
1134
-	* updated in the given timeframe.
1135
-	*
1136
-	* @param string $type
1137
-	*   Object type name, E.g., Contact, Account.
1138
-	*
1139
-	* @param int $start
1140
-	*   unix timestamp for older timeframe for updates.
1141
-	*   Defaults to "-29 days" if empty.
1142
-	*
1143
-	* @param int $end
1144
-	*   unix timestamp for end of timeframe for updates.
1145
-	*   Defaults to now if empty
1146
-	*
1147
-	* @return array
1148
-	*   return array has 2 indexes:
1149
-	*     "ids": a list of SFIDs of those records which have been created or
1150
-	*       updated in the given timeframe.
1151
-	*     "latestDateCovered": ISO 8601 format timestamp (UTC) of the last date
1152
-	*       covered in the request.
1153
-	*
1154
-	* @see https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_getupdated.htm
1155
-	*
1156
-	* part of core API calls
1157
-	*/
1133
+	 * Return a list of SFIDs for the given object, which have been created or
1134
+	 * updated in the given timeframe.
1135
+	 *
1136
+	 * @param string $type
1137
+	 *   Object type name, E.g., Contact, Account.
1138
+	 *
1139
+	 * @param int $start
1140
+	 *   unix timestamp for older timeframe for updates.
1141
+	 *   Defaults to "-29 days" if empty.
1142
+	 *
1143
+	 * @param int $end
1144
+	 *   unix timestamp for end of timeframe for updates.
1145
+	 *   Defaults to now if empty
1146
+	 *
1147
+	 * @return array
1148
+	 *   return array has 2 indexes:
1149
+	 *     "ids": a list of SFIDs of those records which have been created or
1150
+	 *       updated in the given timeframe.
1151
+	 *     "latestDateCovered": ISO 8601 format timestamp (UTC) of the last date
1152
+	 *       covered in the request.
1153
+	 *
1154
+	 * @see https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_getupdated.htm
1155
+	 *
1156
+	 * part of core API calls
1157
+	 */
1158 1158
 	public function get_updated( $type, $start = null, $end = null ) {
1159 1159
 		if ( empty( $start ) ) {
1160 1160
 			$start = strtotime( '-29 days' );
@@ -1173,19 +1173,19 @@  discard block
 block discarded – undo
1173 1173
 	}
1174 1174
 
1175 1175
 	/**
1176
-	* Given a DeveloperName and SObject Name, return the SFID of the
1177
-	* corresponding RecordType. DeveloperName doesn't change between Salesforce
1178
-	* environments, so it's safer to rely on compared to SFID.
1179
-	*
1180
-	* @param string $name
1181
-	*   Object type name, E.g., Contact, Account.
1182
-	*
1183
-	* @param string $devname
1184
-	*   RecordType DeveloperName, e.g. Donation, Membership, etc.
1185
-	*
1186
-	* @return string SFID
1187
-	*   The Salesforce ID of the given Record Type, or null.
1188
-	*/
1176
+	 * Given a DeveloperName and SObject Name, return the SFID of the
1177
+	 * corresponding RecordType. DeveloperName doesn't change between Salesforce
1178
+	 * environments, so it's safer to rely on compared to SFID.
1179
+	 *
1180
+	 * @param string $name
1181
+	 *   Object type name, E.g., Contact, Account.
1182
+	 *
1183
+	 * @param string $devname
1184
+	 *   RecordType DeveloperName, e.g. Donation, Membership, etc.
1185
+	 *
1186
+	 * @return string SFID
1187
+	 *   The Salesforce ID of the given Record Type, or null.
1188
+	 */
1189 1189
 
1190 1190
 	public function get_record_type_id_by_developer_name( $name, $devname, $reset = false ) {
1191 1191
 
@@ -1213,10 +1213,10 @@  discard block
 block discarded – undo
1213 1213
 	}
1214 1214
 
1215 1215
 	/**
1216
-	* If there is a WordPress setting for how long to keep the cache, return it and set the object property
1217
-	* Otherwise, return seconds in 24 hours
1218
-	*
1219
-	*/
1216
+	 * If there is a WordPress setting for how long to keep the cache, return it and set the object property
1217
+	 * Otherwise, return seconds in 24 hours
1218
+	 *
1219
+	 */
1220 1220
 	private function cache_expiration() {
1221 1221
 		$cache_expiration = $this->wordpress->cache_expiration( 'object_sync_for_salesforce_cache_expiration', 86400 );
1222 1222
 		return $cache_expiration;
Please login to merge, or discard this patch.