Object_Sync_Sf_Sync_Transients::get()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 27
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 11
nc 3
nop 4
dl 0
loc 27
rs 9.9
c 0
b 0
f 0
1
<?php
2
/**
3
 * Handles getting and setting the transients.
4
 *
5
 * @class   Object_Sync_Sf_Sync_Transients
6
 * @package Object_Sync_Salesforce
7
 */
8
9
defined( 'ABSPATH' ) || exit;
10
11
/**
12
 * Object_Sync_Sf_Sync_Transients class.
13
 */
14
class Object_Sync_Sf_Sync_Transients {
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
	 * Transient keys that can be upgraded
32
	 *
33
	 * @var string
34
	 * @deprecated   this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version.
35
	 */
36
	private $upgradeable_keys;
37
38
	/**
39
	 * Constructor for transient records class
40
	 */
41
	public function __construct() {
42
		$this->version          = object_sync_for_salesforce()->version;
43
		$this->option_prefix    = object_sync_for_salesforce()->option_prefix;
44
		$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 property Object_Sync_Sf_Sync_Transients::$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

44
		/** @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...
Deprecated Code introduced by
The function Object_Sync_Sf_Sync_Tran...:get_upgradeable_keys() has been deprecated: this was added in 2.1.0 to upgrade old transient 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

44
		$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...
45
46
	}
47
48
	/**
49
	 * Generate a transient key
50
	 *
51
	 * @param array $params the pieces to put together.
52
	 * @param bool  $legacy whether this is a legacy key. This is for deprecated keys and will be removed in a future version.
53
	 * @return string $key the full transient key.
54
	 */
55
	private function generate_transient_key( $params, $legacy = false ) {
56
		array_unshift( $params, substr( $this->option_prefix, 0, -1 ) ); // add the prefixes.
57
		// remove null and empty values.
58
		$params = array_filter(
59
			$params,
60
			function( $value ) {
61
				return ! is_null( $value ) && '' !== $value;
62
			}
63
		);
64
65
		// legacy keys don't have a fieldmap.
66
		if ( true === $legacy && isset( $params['fieldmap_id'] ) ) {
67
			unset( $params['fieldmap_id'] );
68
		}
69
70
		// make the key a string.
71
		$key = implode( '_', $params );
72
73
		// note: the WordPress codex indicates that option names do not need to be escaped.
74
		// see: https://developer.wordpress.org/reference/functions/update_option/.
75
76
		return $key;
77
	}
78
79
	/**
80
	 * Set individual transient records for sync operations
81
	 *
82
	 * @param string $operation what is the transient related to? last pull, current pull, merge, delete, etc.
83
	 * @param string $object_type the Salesforce object type.
84
	 * @param int    $fieldmap_id the ID of the specific fieldmap that is running.
85
	 * @param mixed  $value the value to be saved in the option.
86
	 * @param int    $expiration whether to expire the transient.
87
	 * @return bool  $result value of the save operation.
88
	 */
89
	public function set( $operation, $object_type = '', $fieldmap_id = '', $value = '', $expiration = 0 ) {
90
		// generate the option key parameters.
91
		$params = array(
92
			'operation'   => $operation,
93
			'object_type' => $object_type,
94
			'fieldmap_id' => $fieldmap_id,
95
		);
96
		$key    = $this->generate_transient_key( $params );
97
		$value  = isset( $value ) ? $value : '';
98
99
		/*
100
		 * examples
101
		 * object_sync_for_salesforce_pull_last_sync_Contact_1
102
		 * object_sync_for_salesforce_currently_pulling_query_Contact_1
103
		 * object_sync_for_salesforce_pull_merge_last_Contact_1
104
		 * object_sync_for_salesforce_pull_delete_last_Contact_1
105
		 */
106
107
		$result = set_transient( $key, $value, $expiration );
0 ignored issues
show
Bug introduced by
The function set_transient 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

107
		$result = /** @scrutinizer ignore-call */ set_transient( $key, $value, $expiration );
Loading history...
108
109
		if ( true === $result ) {
110
			$legacy_key = $this->generate_transient_key( $params, true );
111
			// if the legacy key exists and the keys are not the same, we might need to upgrade.
112
			if ( get_transient( $legacy_key ) && $key !== $legacy_key ) {
0 ignored issues
show
Bug introduced by
The function get_transient 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

112
			if ( /** @scrutinizer ignore-call */ get_transient( $legacy_key ) && $key !== $legacy_key ) {
Loading history...
113
				$this->legacy_transient_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_Sync_Tran...acy_transient_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

113
				$this->legacy_transient_upgrade( $operation, $object_type, /** @scrutinizer ignore-type */ $fieldmap_id );
Loading history...
Deprecated Code introduced by
The function Object_Sync_Sf_Sync_Tran...acy_transient_upgrade() has been deprecated: this was added in 2.1.0 to upgrade old transient 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

113
				/** @scrutinizer ignore-deprecated */ $this->legacy_transient_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...
114
			}
115
		}
116
		return $result;
117
	}
118
119
	/**
120
	 * Set individual transient records for sync operations
121
	 *
122
	 * @param string $operation what is the option related to? last pull, current pull, merge, delete, etc.
123
	 * @param string $object_type the Salesforce object type.
124
	 * @param int    $fieldmap_id the ID of the specific fieldmap that is running.
125
	 * @param mixed  $value the value to be saved in the option.
126
	 * @param int    $expiration whether to expire the transient.
127
	 * @return bool  $result value of the save operation.
128
	 * @deprecated   this was added in 2.1.0 to upgrade old transient keys, but will be removed in a future version.
129
	 */
130
	private function legacy_transient_upgrade( $operation, $object_type = '', $fieldmap_id = '', $value = '', $expiration = 0 ) {
0 ignored issues
show
Unused Code introduced by
The parameter $expiration 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

130
	private function legacy_transient_upgrade( $operation, $object_type = '', $fieldmap_id = '', $value = '', /** @scrutinizer ignore-unused */ $expiration = 0 ) {

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

130
	private function legacy_transient_upgrade( $operation, $object_type = '', $fieldmap_id = '', /** @scrutinizer ignore-unused */ $value = '', $expiration = 0 ) {

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...
131
		$result       = false;
132
		$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_Sync_Transients::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

132
		$legacy_value = $this->legacy_get( $operation, $object_type, /** @scrutinizer ignore-type */ $fieldmap_id );
Loading history...
Deprecated Code introduced by
The function Object_Sync_Sf_Sync_Transients::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

132
		$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...
133
		if ( false !== $legacy_value ) {
134
			// generate the option key parameters.
135
			$params = array(
136
				'operation'   => $operation,
137
				'object_type' => $object_type,
138
				'fieldmap_id' => $fieldmap_id,
139
			);
140
			$key    = $this->generate_transient_key( $params, true );
141
			$this->add_upgradeable_key( $key );
0 ignored issues
show
Deprecated Code introduced by
The function Object_Sync_Sf_Sync_Tran...::add_upgradeable_key() has been deprecated: this was added in 2.1.0 to upgrade old transient 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

141
			/** @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...
142
			$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_Sync_Transients::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

142
			$result = $this->set( $operation, $object_type, /** @scrutinizer ignore-type */ $fieldmap_id, $legacy_value );
Loading history...
143
			if ( true === $result ) {
144
				$this->legacy_delete( $key );
0 ignored issues
show
Deprecated Code introduced by
The function Object_Sync_Sf_Sync_Transients::legacy_delete() has been deprecated: this was added in 2.1.0 to upgrade old transient 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

144
				/** @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...
145
			}
146
		}
147
		return $result;
148
	}
149
150
	/**
151
	 * Get individual transient records for sync operations
152
	 *
153
	 * @param string $operation what is the option related to? last pull, current pull, merge, delete, etc.
154
	 * @param string $object_type the WordPress or Salesforce object type.
155
	 * @param int    $fieldmap_id the ID of the specific fieldmap that is running.
156
	 * @param mixed  $default the default value for the transient.
157
	 * @return mixed $value the value of the item. False if it's empty.
158
	 */
159
	public function get( $operation, $object_type = '', $fieldmap_id = '', $default = false ) {
160
		// generate the transient key parameters.
161
		$params = array(
162
			'operation'   => $operation,
163
			'object_type' => $object_type,
164
			'fieldmap_id' => $fieldmap_id,
165
		);
166
		$key    = $this->generate_transient_key( $params );
167
		$value  = get_transient( $key );
0 ignored issues
show
Bug introduced by
The function get_transient 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

167
		$value  = /** @scrutinizer ignore-call */ get_transient( $key );
Loading history...
168
169
		/*
170
		 * examples
171
		 * object_sync_for_salesforce_pull_last_sync_Contact_1
172
		 * object_sync_for_salesforce_currently_pulling_query_Contact_1
173
		 * object_sync_for_salesforce_pull_merge_last_Contact_1
174
		 * object_sync_for_salesforce_pull_delete_last_Contact_1
175
		 */
176
177
		// if the new transient value does exist but it has a default value, try to upgrade the old one.
178
		if ( get_transient( $key ) && $default === $value ) {
179
			$legacy_key = $this->generate_transient_key( $params, true );
180
			// if the keys are not the same, we might need to upgrade.
181
			if ( $key !== $legacy_key ) {
182
				$this->legacy_transient_upgrade( $operation, $object_type, $fieldmap_id, $value );
0 ignored issues
show
Deprecated Code introduced by
The function Object_Sync_Sf_Sync_Tran...acy_transient_upgrade() has been deprecated: this was added in 2.1.0 to upgrade old transient 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

182
				/** @scrutinizer ignore-deprecated */ $this->legacy_transient_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_Sync_Tran...acy_transient_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

182
				$this->legacy_transient_upgrade( $operation, $object_type, /** @scrutinizer ignore-type */ $fieldmap_id, $value );
Loading history...
183
			}
184
		}
185
		return $value;
186
	}
187
188
	/**
189
	 * Get legacy named individual transiuent records for sync operations
190
	 *
191
	 * @param string $operation what is the transient related to? last pull, current pull, merge, delete, etc.
192
	 * @param string $object_type the WordPress or Salesforce object type.
193
	 * @param int    $fieldmap_id the ID of the specific fieldmap that is running.
194
	 * @return mixed $value the value of the item. False if it's empty.
195
	 * @deprecated   this was added in 2.1.0 to upgrade old option keys, but will be removed in a future version.
196
	 */
197
	public function legacy_get( $operation, $object_type, $fieldmap_id ) {
198
		// generate the transient key parameters.
199
		$params = array(
200
			'operation'   => $operation,
201
			'object_type' => $object_type,
202
			'fieldmap_id' => $fieldmap_id,
203
		);
204
		$key    = $this->generate_transient_key( $params, true );
205
		$value  = get_transient( $key );
0 ignored issues
show
Bug introduced by
The function get_transient 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

205
		$value  = /** @scrutinizer ignore-call */ get_transient( $key );
Loading history...
206
		return $value;
207
	}
208
209
	/**
210
	 * Delete the individual transient records for sync operation
211
	 *
212
	 * @param string $operation what is the transient related to? last pull, current pull, merge, delete, etc.
213
	 * @param string $object_type the WordPress or Salesforce object type.
214
	 * @param int    $fieldmap_id the ID of the specific fieldmap that is running.
215
	 * @return bool  $result True if successful, false otherwise.
216
	 */
217
	public function delete( $operation, $object_type = '', $fieldmap_id = '' ) {
218
		// generate the transient key parameters.
219
		$params = array(
220
			'operation'   => $operation,
221
			'object_type' => $object_type,
222
			'fieldmap_id' => $fieldmap_id,
223
		);
224
		$key    = $this->generate_transient_key( $params );
225
		$result = delete_transient( $key );
0 ignored issues
show
Bug introduced by
The function delete_transient 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

225
		$result = /** @scrutinizer ignore-call */ delete_transient( $key );
Loading history...
226
		return $result;
227
	}
228
229
	/**
230
	 * Delete the legacy individual transient records for sync operation
231
	 *
232
	 * @param string $key the legacy key to delete.
233
	 * @return bool  $result True if successful, false otherwise.
234
	 * @deprecated   this was added in 2.1.0 to upgrade old transient keys, but will be removed in a future version.
235
	 */
236
	public function legacy_delete( $key ) {
237
		$result = delete_transient( $key );
0 ignored issues
show
Bug introduced by
The function delete_transient 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

237
		$result = /** @scrutinizer ignore-call */ delete_transient( $key );
Loading history...
238
		if ( true === $result ) {
239
			$this->remove_upgradeable_key( $key );
0 ignored issues
show
Deprecated Code introduced by
The function Object_Sync_Sf_Sync_Tran...emove_upgradeable_key() has been deprecated: this was added in 2.1.0 to upgrade old transient 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

239
			/** @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...
240
		}
241
		return $result;
242
	}
243
244
	/**
245
	 * Add an transient key to the array of upgradeable keys.
246
	 *
247
	 * @param string $key the key to add to the array.
248
	 * @return array $this->upgradeable_keys the array of keys.
249
	 * @deprecated   this was added in 2.1.0 to upgrade old transient keys, but will be removed in a future version.
250
	 */
251
	private function add_upgradeable_key( $key ) {
252
		$keys   = $this->get_upgradeable_keys();
0 ignored issues
show
Deprecated Code introduced by
The function Object_Sync_Sf_Sync_Tran...:get_upgradeable_keys() has been deprecated: this was added in 2.1.0 to upgrade old transient 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

252
		$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...
253
		$keys[] = $key;
254
		$keys   = array_unique( $keys );
255
		$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

255
		$result = /** @scrutinizer ignore-call */ update_option( $this->option_prefix . 'upgradeable_keys', $keys );
Loading history...
256
		if ( true === $result ) {
257
			$this->upgradeable_keys = $keys;
0 ignored issues
show
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...
Deprecated Code introduced by
The property Object_Sync_Sf_Sync_Transients::$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

257
			/** @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...
258
			return $this->upgradeable_keys;
0 ignored issues
show
Deprecated Code introduced by
The property Object_Sync_Sf_Sync_Transients::$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

258
			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...
259
		}
260
	}
261
262
	/**
263
	 * Remove a transient key from the array of upgradeable keys.
264
	 *
265
	 * @param string $key the key to remove from the array.
266
	 * @return array $this->upgradeable_keys the array of keys.
267
	 * @deprecated   this was added in 2.1.0 to upgrade old transient keys, but will be removed in a future version.
268
	 */
269
	private function remove_upgradeable_key( $key ) {
270
		$keys      = $this->get_upgradeable_keys();
0 ignored issues
show
Deprecated Code introduced by
The function Object_Sync_Sf_Sync_Tran...:get_upgradeable_keys() has been deprecated: this was added in 2.1.0 to upgrade old transient 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

270
		$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...
271
		$array_key = array_search( $key, $keys, true );
272
		if ( false !== $array_key ) {
273
			unset( $keys[ $array_key ] );
274
		}
275
		$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

275
		$result = /** @scrutinizer ignore-call */ update_option( $this->option_prefix . 'upgradeable_keys', $keys );
Loading history...
276
		if ( true === $result ) {
277
			$this->upgradeable_keys = $keys;
0 ignored issues
show
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...
Deprecated Code introduced by
The property Object_Sync_Sf_Sync_Transients::$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

277
			/** @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...
278
			if ( empty( $keys ) ) {
279
				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

279
				/** @scrutinizer ignore-call */ 
280
    delete_option( $this->option_prefix . 'upgradeable_keys' );
Loading history...
280
			}
281
			return $this->upgradeable_keys;
0 ignored issues
show
Deprecated Code introduced by
The property Object_Sync_Sf_Sync_Transients::$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
			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...
282
		}
283
	}
284
285
	/**
286
	 * Get the array of upgradeable keys.
287
	 *
288
	 * @return array $this->upgradeable_keys the array of keys.
289
	 * @deprecated   this was added in 2.1.0 to upgrade old transient keys, but will be removed in a future version.
290
	 */
291
	private function get_upgradeable_keys() {
292
		$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

292
		$keys                   = /** @scrutinizer ignore-call */ get_option( $this->option_prefix . 'upgradeable_keys', array() );
Loading history...
293
		$keys                   = array_unique( $keys );
294
		$this->upgradeable_keys = $keys;
0 ignored issues
show
Deprecated Code introduced by
The property Object_Sync_Sf_Sync_Transients::$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

294
		/** @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...
295
		return $this->upgradeable_keys;
0 ignored issues
show
Deprecated Code introduced by
The property Object_Sync_Sf_Sync_Transients::$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

295
		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...
296
	}
297
}
298