Object_Sync_Sf_Pull_Options   A
last analyzed

Complexity

Total Complexity 28

Size/Duplication

Total Lines 293
Duplicated Lines 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
eloc 93
c 5
b 0
f 0
dl 0
loc 293
rs 10
wmc 28

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A set() 0 28 5
A legacy_get() 0 10 1
A add_upgradeable_key() 0 8 2
A legacy_option_upgrade() 0 18 3
A get() 0 27 4
A remove_upgradeable_key() 0 13 4
A get_upgradeable_keys() 0 5 1
A delete() 0 10 1
A legacy_delete() 0 6 2
A generate_option_key() 0 22 4
1
<?php
2
/**
3
 * Handles getting and setting the pull options.
4
 *
5
 * @class   Object_Sync_Sf_Pull_Options
6
 * @package Object_Sync_Salesforce
7
 */
8
9
defined( 'ABSPATH' ) || exit;
10
11
/**
12
 * Object_Sync_Sf_Pull_Options class.
13
 */
14
class Object_Sync_Sf_Pull_Options {
15
16
	/**
17
	 * Current version of the plugin
18
	 *
19
	 * @var string
20
	 */
21
	public $version;
22
23
	/**
24
	 * The plugin's prefix when saving options to the database
25
	 *
26
	 * @var string
27
	 */
28
	public $option_prefix;
29
30
	/**
31
	 * Direction of the operation
32
	 *
33
	 * @var string
34
	 */
35
	public $direction;
36
37
	/**
38
	 * Option keys that can be upgraded
39
	 *
40
	 * @var string
41
	 * @deprecated   this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version.
42
	 */
43
	private $upgradeable_keys;
44
45
	/**
46
	 * Constructor for option records class
47
	 */
48
	public function __construct() {
49
		$this->version       = object_sync_for_salesforce()->version;
50
		$this->option_prefix = object_sync_for_salesforce()->option_prefix;
51
52
		$this->direction = 'pull';
53
54
		$this->upgradeable_keys = $this->get_upgradeable_keys();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->get_upgradeable_keys() of type array is incompatible with the declared type string of property $upgradeable_keys.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
Deprecated Code introduced by
The function Object_Sync_Sf_Pull_Opti...:get_upgradeable_keys() has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

54
		$this->upgradeable_keys = /** @scrutinizer ignore-deprecated */ $this->get_upgradeable_keys();

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
Deprecated Code introduced by
The property Object_Sync_Sf_Pull_Options::$upgradeable_keys has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

54
		/** @scrutinizer ignore-deprecated */ $this->upgradeable_keys = $this->get_upgradeable_keys();

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
55
56
	}
57
58
	/**
59
	 * Generate an option key
60
	 *
61
	 * @param array $params the pieces to put together.
62
	 * @param bool  $legacy whether this is a legacy key. This is for deprecated keys and will be removed in a future version.
63
	 * @return string $key the full option key.
64
	 */
65
	private function generate_option_key( $params, $legacy = false ) {
66
		array_unshift( $params, substr( $this->option_prefix, 0, -1 ), $this->direction ); // add the prefixes.
67
		// remove null and empty values.
68
		$params = array_filter(
69
			$params,
70
			function( $value ) {
71
				return ! is_null( $value ) && '' !== $value;
72
			}
73
		);
74
75
		// legacy keys don't have a fieldmap.
76
		if ( true === $legacy && isset( $params['fieldmap_id'] ) ) {
77
			unset( $params['fieldmap_id'] );
78
		}
79
80
		// make the key a string.
81
		$key = implode( '_', $params );
82
83
		// note: the WordPress codex indicates that option names do not need to be escaped.
84
		// see: https://developer.wordpress.org/reference/functions/update_option/.
85
86
		return $key;
87
	}
88
89
	/**
90
	 * Set individual option records for sync operations
91
	 *
92
	 * @param string $operation what is the option related to? last pull, current pull, merge, delete, etc.
93
	 * @param string $object_type the Salesforce object type.
94
	 * @param int    $fieldmap_id the ID of the specific fieldmap that is running.
95
	 * @param mixed  $value the value to be saved in the option.
96
	 * @param bool   $autoload whether to autoload the option value. Default to false to avoid the cache.
97
	 * @return bool  $result value of the save operation.
98
	 */
99
	public function set( $operation, $object_type = '', $fieldmap_id = '', $value = '', $autoload = false ) {
100
		// generate the option key parameters.
101
		$params = array(
102
			'operation'   => $operation,
103
			'object_type' => $object_type,
104
			'fieldmap_id' => $fieldmap_id,
105
		);
106
		$key    = $this->generate_option_key( $params );
107
		$value  = isset( $value ) ? $value : '';
108
109
		/*
110
		 * examples
111
		 * object_sync_for_salesforce_pull_last_sync_Contact_1
112
		 * object_sync_for_salesforce_currently_pulling_query_Contact_1
113
		 * object_sync_for_salesforce_pull_merge_last_Contact_1
114
		 * object_sync_for_salesforce_pull_delete_last_Contact_1
115
		 */
116
117
		$result = update_option( $key, $value, $autoload );
0 ignored issues
show
Bug introduced by
The function update_option was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

117
		$result = /** @scrutinizer ignore-call */ update_option( $key, $value, $autoload );
Loading history...
118
119
		if ( true === $result ) {
120
			$legacy_key = $this->generate_option_key( $params, true );
121
			// if the legacy key exists and the keys are not the same, we might need to upgrade.
122
			if ( get_option( $legacy_key ) && $key !== $legacy_key ) {
0 ignored issues
show
Bug introduced by
The function get_option was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

122
			if ( /** @scrutinizer ignore-call */ get_option( $legacy_key ) && $key !== $legacy_key ) {
Loading history...
123
				$this->legacy_option_upgrade( $operation, $object_type, $fieldmap_id );
0 ignored issues
show
Bug introduced by
It seems like $fieldmap_id can also be of type string; however, parameter $fieldmap_id of Object_Sync_Sf_Pull_Opti...legacy_option_upgrade() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

123
				$this->legacy_option_upgrade( $operation, $object_type, /** @scrutinizer ignore-type */ $fieldmap_id );
Loading history...
Deprecated Code introduced by
The function Object_Sync_Sf_Pull_Opti...legacy_option_upgrade() has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

123
				/** @scrutinizer ignore-deprecated */ $this->legacy_option_upgrade( $operation, $object_type, $fieldmap_id );

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
124
			}
125
		}
126
		return $result;
127
	}
128
129
	/**
130
	 * Set individual option records for sync operations
131
	 *
132
	 * @param string $operation what is the option related to? last pull, current pull, merge, delete, etc.
133
	 * @param string $object_type the Salesforce object type.
134
	 * @param int    $fieldmap_id the ID of the specific fieldmap that is running.
135
	 * @param mixed  $value the value to be saved in the option.
136
	 * @param bool   $autoload whether to autoload the option value.
137
	 * @return bool  $result value of the save operation.
138
	 * @deprecated   this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version.
139
	 */
140
	private function legacy_option_upgrade( $operation, $object_type = '', $fieldmap_id = '', $value = '', $autoload = true ) {
0 ignored issues
show
Unused Code introduced by
The parameter $autoload is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

140
	private function legacy_option_upgrade( $operation, $object_type = '', $fieldmap_id = '', $value = '', /** @scrutinizer ignore-unused */ $autoload = true ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $value is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

140
	private function legacy_option_upgrade( $operation, $object_type = '', $fieldmap_id = '', /** @scrutinizer ignore-unused */ $value = '', $autoload = true ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
141
		$result       = false;
142
		$legacy_value = $this->legacy_get( $operation, $object_type, $fieldmap_id );
0 ignored issues
show
Bug introduced by
It seems like $fieldmap_id can also be of type string; however, parameter $fieldmap_id of Object_Sync_Sf_Pull_Options::legacy_get() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

142
		$legacy_value = $this->legacy_get( $operation, $object_type, /** @scrutinizer ignore-type */ $fieldmap_id );
Loading history...
Deprecated Code introduced by
The function Object_Sync_Sf_Pull_Options::legacy_get() has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

142
		$legacy_value = /** @scrutinizer ignore-deprecated */ $this->legacy_get( $operation, $object_type, $fieldmap_id );

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
143
		if ( false !== $legacy_value ) {
144
			// generate the option key parameters.
145
			$params = array(
146
				'operation'   => $operation,
147
				'object_type' => $object_type,
148
				'fieldmap_id' => $fieldmap_id,
149
			);
150
			$key    = $this->generate_option_key( $params, true );
151
			$this->add_upgradeable_key( $key );
0 ignored issues
show
Deprecated Code introduced by
The function Object_Sync_Sf_Pull_Options::add_upgradeable_key() has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

151
			/** @scrutinizer ignore-deprecated */ $this->add_upgradeable_key( $key );

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
152
			$result = $this->set( $operation, $object_type, $fieldmap_id, $legacy_value );
0 ignored issues
show
Bug introduced by
It seems like $fieldmap_id can also be of type string; however, parameter $fieldmap_id of Object_Sync_Sf_Pull_Options::set() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

152
			$result = $this->set( $operation, $object_type, /** @scrutinizer ignore-type */ $fieldmap_id, $legacy_value );
Loading history...
153
			if ( true === $result ) {
154
				$this->legacy_delete( $key );
0 ignored issues
show
Deprecated Code introduced by
The function Object_Sync_Sf_Pull_Options::legacy_delete() has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

154
				/** @scrutinizer ignore-deprecated */ $this->legacy_delete( $key );

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
155
			}
156
		}
157
		return $result;
158
	}
159
160
	/**
161
	 * Get individual option records for sync operations
162
	 *
163
	 * @param string $operation what is the option related to? last pull, current pull, merge, delete, etc.
164
	 * @param string $object_type the Salesforce object type.
165
	 * @param int    $fieldmap_id the ID of the specific fieldmap that is running.
166
	 * @param mixed  $default the default value for the option.
167
	 * @return mixed $value the value of the item. False if it's empty.
168
	 */
169
	public function get( $operation, $object_type = '', $fieldmap_id = '', $default = false ) {
170
		// generate the option key parameters.
171
		$params = array(
172
			'operation'   => $operation,
173
			'object_type' => $object_type,
174
			'fieldmap_id' => $fieldmap_id,
175
		);
176
		$key    = $this->generate_option_key( $params );
177
		$value  = get_option( $key, $default );
0 ignored issues
show
Bug introduced by
The function get_option was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

177
		$value  = /** @scrutinizer ignore-call */ get_option( $key, $default );
Loading history...
178
179
		/*
180
		 * examples
181
		 * object_sync_for_salesforce_pull_last_sync_Contact_1
182
		 * object_sync_for_salesforce_currently_pulling_query_Contact_1
183
		 * object_sync_for_salesforce_pull_merge_last_Contact_1
184
		 * object_sync_for_salesforce_pull_delete_last_Contact_1
185
		 */
186
187
		// if the new option value does exist but it has a default value, try to upgrade the old one.
188
		if ( get_option( $key ) && $default === $value ) {
189
			$legacy_key = $this->generate_option_key( $params, true );
190
			// if the keys are not the same, we might need to upgrade.
191
			if ( $key !== $legacy_key ) {
192
				$this->legacy_option_upgrade( $operation, $object_type, $fieldmap_id, $value );
0 ignored issues
show
Deprecated Code introduced by
The function Object_Sync_Sf_Pull_Opti...legacy_option_upgrade() has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

192
				/** @scrutinizer ignore-deprecated */ $this->legacy_option_upgrade( $operation, $object_type, $fieldmap_id, $value );

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
Bug introduced by
It seems like $fieldmap_id can also be of type string; however, parameter $fieldmap_id of Object_Sync_Sf_Pull_Opti...legacy_option_upgrade() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

192
				$this->legacy_option_upgrade( $operation, $object_type, /** @scrutinizer ignore-type */ $fieldmap_id, $value );
Loading history...
193
			}
194
		}
195
		return $value;
196
	}
197
198
	/**
199
	 * Get legacy named individual option records for sync operations
200
	 *
201
	 * @param string $operation what is the option related to? last pull, current pull, merge, delete, etc.
202
	 * @param string $object_type the Salesforce object type.
203
	 * @param int    $fieldmap_id the ID of the specific fieldmap that is running.
204
	 * @param mixed  $default the default value for the option.
205
	 * @return mixed $value the value of the item. False if it's empty.
206
	 * @deprecated   this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version.
207
	 */
208
	public function legacy_get( $operation, $object_type, $fieldmap_id, $default = false ) {
209
		// generate the option key parameters.
210
		$params = array(
211
			'operation'   => $operation,
212
			'object_type' => $object_type,
213
			'fieldmap_id' => $fieldmap_id,
214
		);
215
		$key    = $this->generate_option_key( $params, true );
216
		$value  = get_option( $key, $default );
0 ignored issues
show
Bug introduced by
The function get_option was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

216
		$value  = /** @scrutinizer ignore-call */ get_option( $key, $default );
Loading history...
217
		return $value;
218
	}
219
220
	/**
221
	 * Delete the individual option records for sync operation
222
	 *
223
	 * @param string $operation what is the option related to? last pull, current pull, merge, delete, etc.
224
	 * @param string $object_type the Salesforce object type.
225
	 * @param int    $fieldmap_id the ID of the specific fieldmap that is running.
226
	 * @return bool  $result True if successful, false otherwise.
227
	 */
228
	public function delete( $operation, $object_type = '', $fieldmap_id = '' ) {
229
		// generate the option key parameters.
230
		$params = array(
231
			'operation'   => $operation,
232
			'object_type' => $object_type,
233
			'fieldmap_id' => $fieldmap_id,
234
		);
235
		$key    = $this->generate_option_key( $params );
236
		$result = delete_option( $key );
0 ignored issues
show
Bug introduced by
The function delete_option was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

236
		$result = /** @scrutinizer ignore-call */ delete_option( $key );
Loading history...
237
		return $result;
238
	}
239
240
	/**
241
	 * Delete the legacy individual option records for sync operation
242
	 *
243
	 * @param string $key the legacy key to delete.
244
	 * @return bool  $result True if successful, false otherwise.
245
	 * @deprecated   this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version.
246
	 */
247
	public function legacy_delete( $key ) {
248
		$result = delete_option( $key );
0 ignored issues
show
Bug introduced by
The function delete_option was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

248
		$result = /** @scrutinizer ignore-call */ delete_option( $key );
Loading history...
249
		if ( true === $result ) {
250
			$this->remove_upgradeable_key( $key );
0 ignored issues
show
Deprecated Code introduced by
The function Object_Sync_Sf_Pull_Opti...emove_upgradeable_key() has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

250
			/** @scrutinizer ignore-deprecated */ $this->remove_upgradeable_key( $key );

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
251
		}
252
		return $result;
253
	}
254
255
	/**
256
	 * Add an option key to the array of upgradeable keys.
257
	 *
258
	 * @param string $key the key to add to the array.
259
	 * @return array $this->upgradeable_keys the array of keys.
260
	 * @deprecated   this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version.
261
	 */
262
	private function add_upgradeable_key( $key ) {
263
		$keys   = $this->get_upgradeable_keys();
0 ignored issues
show
Deprecated Code introduced by
The function Object_Sync_Sf_Pull_Opti...:get_upgradeable_keys() has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

263
		$keys   = /** @scrutinizer ignore-deprecated */ $this->get_upgradeable_keys();

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
264
		$keys[] = $key;
265
		$keys   = array_unique( $keys );
266
		$result = update_option( $this->option_prefix . 'upgradeable_keys', $keys );
0 ignored issues
show
Bug introduced by
The function update_option was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

266
		$result = /** @scrutinizer ignore-call */ update_option( $this->option_prefix . 'upgradeable_keys', $keys );
Loading history...
267
		if ( true === $result ) {
268
			$this->upgradeable_keys = $keys;
0 ignored issues
show
Deprecated Code introduced by
The property Object_Sync_Sf_Pull_Options::$upgradeable_keys has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

268
			/** @scrutinizer ignore-deprecated */ $this->upgradeable_keys = $keys;

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
Documentation Bug introduced by
It seems like $keys of type array is incompatible with the declared type string of property $upgradeable_keys.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
269
			return $this->upgradeable_keys;
0 ignored issues
show
Deprecated Code introduced by
The property Object_Sync_Sf_Pull_Options::$upgradeable_keys has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

269
			return /** @scrutinizer ignore-deprecated */ $this->upgradeable_keys;

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
270
		}
271
	}
272
273
	/**
274
	 * Remove an option key from the array of upgradeable keys.
275
	 *
276
	 * @param string $key the key to remove from the array.
277
	 * @return array $this->upgradeable_keys the array of keys.
278
	 * @deprecated   this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version.
279
	 */
280
	private function remove_upgradeable_key( $key ) {
281
		$keys      = $this->get_upgradeable_keys();
0 ignored issues
show
Deprecated Code introduced by
The function Object_Sync_Sf_Pull_Opti...:get_upgradeable_keys() has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

281
		$keys      = /** @scrutinizer ignore-deprecated */ $this->get_upgradeable_keys();

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
282
		$array_key = array_search( $key, $keys, true );
283
		if ( false !== $array_key ) {
284
			unset( $keys[ $array_key ] );
285
		}
286
		$result = update_option( $this->option_prefix . 'upgradeable_keys', $keys );
0 ignored issues
show
Bug introduced by
The function update_option was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

286
		$result = /** @scrutinizer ignore-call */ update_option( $this->option_prefix . 'upgradeable_keys', $keys );
Loading history...
287
		if ( true === $result ) {
288
			$this->upgradeable_keys = $keys;
0 ignored issues
show
Deprecated Code introduced by
The property Object_Sync_Sf_Pull_Options::$upgradeable_keys has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

288
			/** @scrutinizer ignore-deprecated */ $this->upgradeable_keys = $keys;

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
Documentation Bug introduced by
It seems like $keys of type array is incompatible with the declared type string of property $upgradeable_keys.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
289
			if ( empty( $keys ) ) {
290
				delete_option( $this->option_prefix . 'upgradeable_keys' );
0 ignored issues
show
Bug introduced by
The function delete_option was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

290
				/** @scrutinizer ignore-call */ 
291
    delete_option( $this->option_prefix . 'upgradeable_keys' );
Loading history...
291
			}
292
			return $this->upgradeable_keys;
0 ignored issues
show
Deprecated Code introduced by
The property Object_Sync_Sf_Pull_Options::$upgradeable_keys has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

292
			return /** @scrutinizer ignore-deprecated */ $this->upgradeable_keys;

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
293
		}
294
	}
295
296
	/**
297
	 * Get the array of upgradeable keys.
298
	 *
299
	 * @return array $this->upgradeable_keys the array of keys.
300
	 * @deprecated   this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version.
301
	 */
302
	private function get_upgradeable_keys() {
303
		$keys                   = get_option( $this->option_prefix . 'upgradeable_keys', array() );
0 ignored issues
show
Bug introduced by
The function get_option was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

303
		$keys                   = /** @scrutinizer ignore-call */ get_option( $this->option_prefix . 'upgradeable_keys', array() );
Loading history...
304
		$keys                   = array_unique( $keys );
305
		$this->upgradeable_keys = $keys;
0 ignored issues
show
Deprecated Code introduced by
The property Object_Sync_Sf_Pull_Options::$upgradeable_keys has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

305
		/** @scrutinizer ignore-deprecated */ $this->upgradeable_keys = $keys;

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
Documentation Bug introduced by
It seems like $keys of type array is incompatible with the declared type string of property $upgradeable_keys.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
306
		return $this->upgradeable_keys;
0 ignored issues
show
Deprecated Code introduced by
The property Object_Sync_Sf_Pull_Options::$upgradeable_keys has been deprecated: this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

306
		return /** @scrutinizer ignore-deprecated */ $this->upgradeable_keys;

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
307
	}
308
}
309