GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 699b70...879176 )
by Chris
13:23
created
vendor/cmb2/includes/types/CMB2_Type_Picker_Base.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 			if ( $update ) {
31 31
 				$atts = $this->field->args( 'attributes' );
32 32
 			} else {
33
-				$atts = isset( $args['attributes'] )
34
-					? $args['attributes']
33
+				$atts = isset( $args[ 'attributes' ] )
34
+					? $args[ 'attributes' ]
35 35
 					: $atts;
36 36
 			}
37 37
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 
49 49
 		if ( $update ) {
50
-			$this->field->args['attributes'] = $atts;
50
+			$this->field->args[ 'attributes' ] = $atts;
51 51
 		}
52 52
 
53 53
 		return array_merge( $args, $atts );
Please login to merge, or discard this patch.
vendor/cmb2/includes/types/CMB2_Type_Oembed.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 			'data-objecttype' => $field->object_type,
34 34
 		) )
35 35
 		. '<p class="cmb-spinner spinner" style="display:none;"></p>'
36
-		. '<div id="'. $this->_id( '-status' ). '" class="cmb2-media-status ui-helper-clearfix embed_wrap">' . $oembed . '</div>';
36
+		. '<div id="' . $this->_id( '-status' ) . '" class="cmb2-media-status ui-helper-clearfix embed_wrap">' . $oembed . '</div>';
37 37
 	}
38 38
 
39 39
 }
Please login to merge, or discard this patch.
vendor/cmb2/includes/types/CMB2_Type_Text_Date.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 			'js_dependencies' => array( 'jquery-ui-core', 'jquery-ui-datepicker' ),
21 21
 		) );
22 22
 
23
-		if ( false === strpos( $args['class'], 'timepicker' ) ) {
23
+		if ( false === strpos( $args[ 'class' ], 'timepicker' ) ) {
24 24
 			$this->parse_picker_options( 'date' );
25 25
 		}
26 26
 
Please login to merge, or discard this patch.
vendor/cmb2/includes/types/CMB2_Type_Text.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@
 block discarded – undo
50 50
 			'js_dependencies' => array(),
51 51
 		), $args );
52 52
 
53
-		if ( ! empty( $a['js_dependencies'] ) ) {
54
-			$this->field->add_js_dependencies( $a['js_dependencies'] );
53
+		if ( ! empty( $a[ 'js_dependencies' ] ) ) {
54
+			$this->field->add_js_dependencies( $a[ 'js_dependencies' ] );
55 55
 		}
56 56
 
57 57
 		return $this->rendered(
58
-			sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc', 'js_dependencies' ) ), $a['desc'] )
58
+			sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc', 'js_dependencies' ) ), $a[ 'desc' ] )
59 59
 		);
60 60
 	}
61 61
 }
Please login to merge, or discard this patch.
vendor/cmb2/includes/CMB2_hookup.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
 		if ( $this->cmb->has_columns ) {
98 98
 			add_filter( 'manage_edit-comments_columns', array( $this, 'register_column_headers' ) );
99
-			add_action( 'manage_comments_custom_column', array( $this, 'column_display'  ), 10, 3 );
99
+			add_action( 'manage_comments_custom_column', array( $this, 'column_display' ), 10, 3 );
100 100
 		}
101 101
 	}
102 102
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		if ( $this->cmb->has_columns ) {
115 115
 			add_filter( 'manage_users_columns', array( $this, 'register_column_headers' ) );
116
-			add_filter( 'manage_users_custom_column', array( $this, 'return_column_display'  ), 10, 3 );
116
+			add_filter( 'manage_users_custom_column', array( $this, 'return_column_display' ), 10, 3 );
117 117
 		}
118 118
 	}
119 119
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
 			if ( $this->cmb->has_columns ) {
149 149
 				add_filter( "manage_edit-{$taxonomy}_columns", array( $this, 'register_column_headers' ) );
150
-				add_filter( "manage_{$taxonomy}_custom_column", array( $this, 'return_column_display'  ), 10, 3 );
150
+				add_filter( "manage_{$taxonomy}_custom_column", array( $this, 'return_column_display' ), 10, 3 );
151 151
 			}
152 152
 		}
153 153
 
@@ -240,25 +240,25 @@  discard block
 block discarded – undo
240 240
 		$fields = $this->cmb->prop( 'fields' );
241 241
 
242 242
 		foreach ( $fields as $key => $field ) {
243
-			if ( ! isset( $field['column'] ) ) {
243
+			if ( ! isset( $field[ 'column' ] ) ) {
244 244
 				continue;
245 245
 			}
246 246
 
247
-			$column = $field['column'];
247
+			$column = $field[ 'column' ];
248 248
 
249
-			if ( false === $column['position'] ) {
249
+			if ( false === $column[ 'position' ] ) {
250 250
 
251
-				$columns[ $field['id'] ] = $column['name'];
251
+				$columns[ $field[ 'id' ] ] = $column[ 'name' ];
252 252
 
253 253
 			} else {
254 254
 
255
-				$before = array_slice( $columns, 0, absint( $column['position'] ) );
256
-				$before[ $field['id'] ] = $column['name'];
255
+				$before = array_slice( $columns, 0, absint( $column[ 'position' ] ) );
256
+				$before[ $field[ 'id' ] ] = $column[ 'name' ];
257 257
 				$columns = $before + $columns;
258 258
 			}
259 259
 
260
-			$column['field'] = $field;
261
-			$this->columns[ $field['id'] ] = $column;
260
+			$column[ 'field' ] = $field;
261
+			$this->columns[ $field[ 'id' ] ] = $column;
262 262
 		}
263 263
 
264 264
 		return $columns;
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	public function column_display( $column_name, $object_id ) {
272 272
 		if ( isset( $this->columns[ $column_name ] ) ) {
273 273
  			$field = new CMB2_Field( array(
274
-				'field_args'  => $this->columns[ $column_name ]['field'],
274
+				'field_args'  => $this->columns[ $column_name ][ 'field' ],
275 275
 				'object_type' => $this->object_type,
276 276
 				'object_id'   => $this->cmb->object_id( $object_id ),
277 277
 				'cmb_id'      => $this->cmb->cmb_id,
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 * @return array           Modified array of classes
353 353
 	 */
354 354
 	public function close_metabox_class( $classes ) {
355
-		$classes[] = 'closed';
355
+		$classes[ ] = 'closed';
356 356
 		return $classes;
357 357
 	}
358 358
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	public function user_new_metabox( $section ) {
373 373
 		if ( $section == $this->cmb->prop( 'new_user_section' ) ) {
374 374
 			$object_id = $this->cmb->object_id();
375
-			$this->cmb->object_id( isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : $object_id );
375
+			$this->cmb->object_id( isset( $_REQUEST[ 'user_id' ] ) ? $_REQUEST[ 'user_id' ] : $object_id );
376 376
 			$this->user_metabox();
377 377
 		}
378 378
 	}
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 
554 554
 			$data_to_delete = array();
555 555
 			foreach ( $this->cmb->prop( 'fields' ) as $field ) {
556
-				$data_to_delete[ $field['id'] ] = '';
556
+				$data_to_delete[ $field[ 'id' ] ] = '';
557 557
 			}
558 558
 
559 559
 			$this->cmb->save_fields( $term_id, 'term', $data_to_delete );
Please login to merge, or discard this patch.
vendor/cmb2/includes/CMB2_Utils.php 2 patches
Spacing   +21 added lines, -22 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		$dir = wp_upload_dir();
38 38
 
39 39
 		// Is URL in uploads directory?
40
-		if ( false === strpos( $img_url, $dir['baseurl'] . '/' ) ) {
40
+		if ( false === strpos( $img_url, $dir[ 'baseurl' ] . '/' ) ) {
41 41
 			return false;
42 42
 		}
43 43
 
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 
63 63
 			foreach ( $query->posts as $post_id ) {
64 64
 				$meta = wp_get_attachment_metadata( $post_id );
65
-				$original_file       = basename( $meta['file'] );
66
-				$cropped_image_files = isset( $meta['sizes'] ) ? wp_list_pluck( $meta['sizes'], 'file' ) : array();
65
+				$original_file       = basename( $meta[ 'file' ] );
66
+				$cropped_image_files = isset( $meta[ 'sizes' ] ) ? wp_list_pluck( $meta[ 'sizes' ], 'file' ) : array();
67 67
 				if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) {
68 68
 					$attachment_id = $post_id;
69 69
 					break;
@@ -147,8 +147,7 @@  discard block
 block discarded – undo
147 147
 		}
148 148
 
149 149
 		return self::is_valid_time_stamp( $string )
150
-			? (int) $string :
151
-			strtotime( (string) $string );
150
+			? (int) $string : strtotime( (string) $string );
152 151
 	}
153 152
 
154 153
 	/**
@@ -179,7 +178,7 @@  discard block
 block discarded – undo
179 178
 	 * @param  mixed $value Value to check
180 179
 	 * @return bool         True or false
181 180
 	 */
182
-	public static function notempty( $value ){
181
+	public static function notempty( $value ) {
183 182
 		return null !== $value && '' !== $value && false !== $value;
184 183
 	}
185 184
 
@@ -337,24 +336,24 @@  discard block
 block discarded – undo
337 336
 
338 337
 		// order is relevant here, since the replacement will be done sequentially.
339 338
 		$supported_options = array(
340
-			'd' => 'dd',  // Day, leading 0
341
-			'j' => 'd',   // Day, no 0
342
-			'z' => 'o',   // Day of the year, no leading zeroes,
339
+			'd' => 'dd', // Day, leading 0
340
+			'j' => 'd', // Day, no 0
341
+			'z' => 'o', // Day of the year, no leading zeroes,
343 342
 			// 'D' => 'D',   // Day name short, not sure how it'll work with translations
344 343
 			// 'l' => 'DD',  // Day name full, idem before
345
-			'm' => 'mm',  // Month of the year, leading 0
346
-			'n' => 'm',   // Month of the year, no leading 0
344
+			'm' => 'mm', // Month of the year, leading 0
345
+			'n' => 'm', // Month of the year, no leading 0
347 346
 			// 'M' => 'M',   // Month, Short name
348 347
 			// 'F' => 'MM',  // Month, full name,
349
-			'y' => 'y',   // Year, two digit
350
-			'Y' => 'yy',  // Year, full
351
-			'H' => 'HH',  // Hour with leading 0 (24 hour)
352
-			'G' => 'H',   // Hour with no leading 0 (24 hour)
353
-			'h' => 'hh',  // Hour with leading 0 (12 hour)
354
-			'g' => 'h',   // Hour with no leading 0 (12 hour),
355
-			'i' => 'mm',  // Minute with leading 0,
356
-			's' => 'ss',  // Second with leading 0,
357
-			'a' => 'tt',  // am/pm
348
+			'y' => 'y', // Year, two digit
349
+			'Y' => 'yy', // Year, full
350
+			'H' => 'HH', // Hour with leading 0 (24 hour)
351
+			'G' => 'H', // Hour with no leading 0 (24 hour)
352
+			'h' => 'hh', // Hour with leading 0 (12 hour)
353
+			'g' => 'h', // Hour with no leading 0 (12 hour),
354
+			'i' => 'mm', // Minute with leading 0,
355
+			's' => 'ss', // Second with leading 0,
356
+			'a' => 'tt', // am/pm
358 357
 			'A' => 'TT'   // AM/PM
359 358
 		);
360 359
 
@@ -375,7 +374,7 @@  discard block
 block discarded – undo
375 374
 	 * @return string Modified value
376 375
 	 */
377 376
 	public static function wrap_escaped_chars( $value ) {
378
-		return "&#39;" . str_replace( '\\', '', $value[0] ) . "&#39;";
377
+		return "&#39;" . str_replace( '\\', '', $value[ 0 ] ) . "&#39;";
379 378
 	}
380 379
 
381 380
 	/**
@@ -434,7 +433,7 @@  discard block
 block discarded – undo
434 433
 	 * @return string               String of attributes for form element.
435 434
 	 */
436 435
 	public static function concat_attrs( $attrs, $attr_exclude = array() ) {
437
-		$attr_exclude[] = 'rendered';
436
+		$attr_exclude[ ] = 'rendered';
438 437
 		$attributes = '';
439 438
 		foreach ( $attrs as $attr => $val ) {
440 439
 			$excluded = in_array( $attr, (array) $attr_exclude, true );
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -122,7 +122,8 @@  discard block
 block discarded – undo
122 122
 			$tzstring = '';
123 123
 		}
124 124
 
125
-		if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists
125
+		if ( empty( $tzstring ) ) {
126
+// Create a UTC+- zone if no timezone string exists
126 127
 			if ( 0 == $current_offset ) {
127 128
 				$tzstring = 'UTC+0';
128 129
 			} elseif ( $current_offset < 0 ) {
@@ -179,7 +180,7 @@  discard block
 block discarded – undo
179 180
 	 * @param  mixed $value Value to check
180 181
 	 * @return bool         True or false
181 182
 	 */
182
-	public static function notempty( $value ){
183
+	public static function notempty( $value ) {
183 184
 		return null !== $value && '' !== $value && false !== $value;
184 185
 	}
185 186
 
Please login to merge, or discard this patch.
vendor/cmb2/includes/rest-api/CMB2_REST_Controller_Fields.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 		) );
50 50
 
51 51
 		$delete_args = $args;
52
-		$delete_args['object_id']['required'] = true;
53
-		$delete_args['object_type']['required'] = true;
52
+		$delete_args[ 'object_id' ][ 'required' ] = true;
53
+		$delete_args[ 'object_type' ][ 'required' ] = true;
54 54
 
55 55
 		// Returns specific field data.
56 56
 		register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<cmb_id>[\w-]+)/fields/(?P<field_id>[\w-]+)', array(
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 		foreach ( $this->rest_box->cmb->prop( 'fields', array() ) as $field ) {
123 123
 
124 124
 			// Make sure this field can be read.
125
-			$this->field = $this->rest_box->field_can_read( $field['id'], true );
125
+			$this->field = $this->rest_box->field_can_read( $field[ 'id' ], true );
126 126
 
127 127
 			// And make sure current user can view this box.
128 128
 			if ( $this->field && $this->get_item_permissions_check_filter() ) {
129
-				$fields[ $field['id'] ] = $this->server->response_to_data(
129
+				$fields[ $field[ 'id' ] ] = $this->server->response_to_data(
130 130
 					$this->prepare_field_response(),
131
-					isset( $this->request['_embed'] )
131
+					isset( $this->request[ '_embed' ] )
132 132
 				);
133 133
 			}
134 134
 		}
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	public function update_item( $request ) {
233 233
 		$this->initiate_rest_read_box( $request, 'field_value_update' );
234 234
 
235
-		if ( ! $this->request['value'] ) {
235
+		if ( ! $this->request[ 'value' ] ) {
236 236
 			return new WP_Error( 'cmb2_rest_update_field_error', __( 'CMB2 Field value cannot be updated without the value parameter specified.', 'cmb2' ), array( 'status' => 400 ) );
237 237
 		}
238 238
 
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
 	 * @param  string $activity The modification activity (updated or deleted).
290 290
 	 * @return WP_Error|WP_REST_Response
291 291
 	 */
292
-	public function modify_field_value( $activity) {
292
+	public function modify_field_value( $activity ) {
293 293
 
294
-		if ( ! $this->request['object_id'] || ! $this->request['object_type'] ) {
294
+		if ( ! $this->request[ 'object_id' ] || ! $this->request[ 'object_type' ] ) {
295 295
 			return new WP_Error( 'cmb2_rest_modify_field_value_error', __( 'CMB2 Field value cannot be modified without the object_id and object_type parameters specified.', 'cmb2' ), array( 'status' => 400 ) );
296 296
 		}
297 297
 
@@ -308,13 +308,13 @@  discard block
 block discarded – undo
308 308
 			return new WP_Error( 'cmb2_rest_no_field_by_id_error', __( 'No field found by that id.', 'cmb2' ), array( 'status' => 403 ) );
309 309
 		}
310 310
 
311
-		$this->field->args["value_{$activity}"] = (bool) 'deleted' === $activity
311
+		$this->field->args[ "value_{$activity}" ] = (bool) 'deleted' === $activity
312 312
 			? $this->field->remove_data()
313
-			: $this->field->save_field( $this->request['value'] );
313
+			: $this->field->save_field( $this->request[ 'value' ] );
314 314
 
315 315
 		// If options page, save the $activity options
316
-		if ( 'options-page' == $this->request['object_type'] ) {
317
-			$this->field->args["value_{$activity}"] = cmb2_options( $this->request['object_id'] )->set();
316
+		if ( 'options-page' == $this->request[ 'object_type' ] ) {
317
+			$this->field->args[ "value_{$activity}" ] = cmb2_options( $this->request[ 'object_id' ] )->set();
318 318
 		}
319 319
 
320 320
 		return $this->prepare_read_field( $this->field );
@@ -389,13 +389,13 @@  discard block
 block discarded – undo
389 389
 				$value = $field->options();
390 390
 			} elseif ( in_array( $key, CMB2_Field::$callable_fields, true ) ) {
391 391
 
392
-				if ( isset( $this->request['_rendered'] ) ) {
392
+				if ( isset( $this->request[ '_rendered' ] ) ) {
393 393
 					$value = $key === 'render_row_cb' ? $rendered : $field->get_param_callback_result( $key );
394 394
 				} elseif ( is_array( $value ) ) {
395 395
 					// We need to rewrite callbacks as string as they will cause
396 396
 					// JSON recursion errors.
397
-					$class = is_string( $value[0] ) ? $value[0] : get_class( $value[0] );
398
-					$value = $class . '::' . $value[1];
397
+					$class = is_string( $value[ 0 ] ) ? $value[ 0 ] : get_class( $value[ 0 ] );
398
+					$value = $class . '::' . $value[ 1 ];
399 399
 				}
400 400
 			}
401 401
 
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 			}
409 409
 		}
410 410
 
411
-		if ( $this->request['object_id'] && $this->request['object_type'] ) {
412
-			$field_data['value'] = $field->get_data();
411
+		if ( $this->request[ 'object_id' ] && $this->request[ 'object_type' ] ) {
412
+			$field_data[ 'value' ] = $field->get_data();
413 413
 		}
414 414
 
415 415
 		return $field_data;
Please login to merge, or discard this patch.
vendor/cmb2/includes/rest-api/CMB2_REST_Controller_Boxes.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 			'schema' => array( $this, 'get_item_schema' ),
69 69
 		) );
70 70
 
71
-		$args['_rendered'] = array(
71
+		$args[ '_rendered' ] = array(
72 72
 			'description' => __( 'Includes the fully rendered attributes, \'form_open\', \'form_close\', as well as the enqueued \'js_dependencies\' script handles, and \'css_dependencies\' stylesheet handles.', 'cmb2' ),
73 73
 		);
74 74
 
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 				// And make sure current user can view this box.
133 133
 				&& $this->get_item_permissions_check_filter( $this->request )
134 134
 			) {
135
-				$boxes_data[] = $this->server->response_to_data(
135
+				$boxes_data[ ] = $this->server->response_to_data(
136 136
 					$this->get_rest_box(),
137
-					isset( $this->request['_embed'] )
137
+					isset( $this->request[ '_embed' ] )
138 138
 				);
139 139
 			}
140 140
 		}
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 
209 209
 		$boxes_data = $cmb->meta_box;
210 210
 
211
-		if ( isset( $this->request['_rendered'] ) && $this->namespace_base !== ltrim( CMB2_REST_Controller::get_intial_route(), '/' ) ) {
212
-			$boxes_data['form_open'] = $this->get_cb_results( array( $cmb, 'render_form_open' ) );
213
-			$boxes_data['form_close'] = $this->get_cb_results( array( $cmb, 'render_form_close' ) );
211
+		if ( isset( $this->request[ '_rendered' ] ) && $this->namespace_base !== ltrim( CMB2_REST_Controller::get_intial_route(), '/' ) ) {
212
+			$boxes_data[ 'form_open' ] = $this->get_cb_results( array( $cmb, 'render_form_open' ) );
213
+			$boxes_data[ 'form_close' ] = $this->get_cb_results( array( $cmb, 'render_form_close' ) );
214 214
 
215 215
 			global $wp_scripts, $wp_styles;
216 216
 			$before_css = $wp_styles->queue;
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 
219 219
 			CMB2_JS::enqueue();
220 220
 
221
-			$boxes_data['js_dependencies'] = array_values( array_diff( $wp_scripts->queue, $before_js ) );
222
-			$boxes_data['css_dependencies'] = array_values( array_diff( $wp_styles->queue, $before_css ) );
221
+			$boxes_data[ 'js_dependencies' ] = array_values( array_diff( $wp_scripts->queue, $before_js ) );
222
+			$boxes_data[ 'css_dependencies' ] = array_values( array_diff( $wp_styles->queue, $before_css ) );
223 223
 		}
224 224
 
225 225
 		// TODO: look into 'embed' parameter.
226 226
 		// http://demo.wp-api.org/wp-json/wp/v2/posts?_embed
227
-		unset( $boxes_data['fields'] );
227
+		unset( $boxes_data[ 'fields' ] );
228 228
 		// Handle callable properties.
229
-		unset( $boxes_data['show_on_cb'] );
229
+		unset( $boxes_data[ 'show_on_cb' ] );
230 230
 
231 231
 		$response = rest_ensure_response( $boxes_data );
232 232
 
Please login to merge, or discard this patch.
vendor/cmb2/includes/shim/WP_REST_Controller.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		}
167 167
 
168 168
 		if ( ! empty( $links ) ) {
169
-			$data['_links'] = $links;
169
+			$data[ '_links' ] = $links;
170 170
 		}
171 171
 
172 172
 		return $data;
@@ -183,21 +183,21 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$schema = $this->get_item_schema();
185 185
 		foreach ( $data as $key => $value ) {
186
-			if ( empty( $schema['properties'][ $key ] ) || empty( $schema['properties'][ $key ]['context'] ) ) {
186
+			if ( empty( $schema[ 'properties' ][ $key ] ) || empty( $schema[ 'properties' ][ $key ][ 'context' ] ) ) {
187 187
 				continue;
188 188
 			}
189 189
 
190
-			if ( ! in_array( $context, $schema['properties'][ $key ]['context'] ) ) {
190
+			if ( ! in_array( $context, $schema[ 'properties' ][ $key ][ 'context' ] ) ) {
191 191
 				unset( $data[ $key ] );
192 192
 				continue;
193 193
 			}
194 194
 
195
-			if ( 'object' === $schema['properties'][ $key ]['type'] && ! empty( $schema['properties'][ $key ]['properties'] ) ) {
196
-				foreach ( $schema['properties'][ $key ]['properties'] as $attribute => $details ) {
197
-					if ( empty( $details['context'] ) ) {
195
+			if ( 'object' === $schema[ 'properties' ][ $key ][ 'type' ] && ! empty( $schema[ 'properties' ][ $key ][ 'properties' ] ) ) {
196
+				foreach ( $schema[ 'properties' ][ $key ][ 'properties' ] as $attribute => $details ) {
197
+					if ( empty( $details[ 'context' ] ) ) {
198 198
 						continue;
199 199
 					}
200
-					if ( ! in_array( $context, $details['context'] ) ) {
200
+					if ( ! in_array( $context, $details[ 'context' ] ) ) {
201 201
 						if ( isset( $data[ $key ][ $attribute ] ) ) {
202 202
 							unset( $data[ $key ][ $attribute ] );
203 203
 						}
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$schema = $this->get_item_schema();
229 229
 
230
-		foreach ( $schema['properties'] as &$property ) {
231
-			if ( isset( $property['arg_options'] ) ) {
232
-				unset( $property['arg_options'] );
230
+		foreach ( $schema[ 'properties' ] as &$property ) {
231
+			if ( isset( $property[ 'arg_options' ] ) ) {
232
+				unset( $property[ 'arg_options' ] );
233 233
 			}
234 234
 		}
235 235
 
@@ -286,18 +286,18 @@  discard block
 block discarded – undo
286 286
 			'validate_callback'  => 'rest_validate_request_arg',
287 287
 		);
288 288
 		$schema = $this->get_item_schema();
289
-		if ( empty( $schema['properties'] ) ) {
289
+		if ( empty( $schema[ 'properties' ] ) ) {
290 290
 			return array_merge( $param_details, $args );
291 291
 		}
292 292
 		$contexts = array();
293
-		foreach ( $schema['properties'] as $attributes ) {
294
-			if ( ! empty( $attributes['context'] ) ) {
295
-				$contexts = array_merge( $contexts, $attributes['context'] );
293
+		foreach ( $schema[ 'properties' ] as $attributes ) {
294
+			if ( ! empty( $attributes[ 'context' ] ) ) {
295
+				$contexts = array_merge( $contexts, $attributes[ 'context' ] );
296 296
 			}
297 297
 		}
298 298
 		if ( ! empty( $contexts ) ) {
299
-			$param_details['enum'] = array_unique( $contexts );
300
-			rsort( $param_details['enum'] );
299
+			$param_details[ 'enum' ] = array_unique( $contexts );
300
+			rsort( $param_details[ 'enum' ] );
301 301
 		}
302 302
 		return array_merge( $param_details, $args );
303 303
 	}
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
 
316 316
 		foreach ( $additional_fields as $field_name => $field_options ) {
317 317
 
318
-			if ( ! $field_options['get_callback'] ) {
318
+			if ( ! $field_options[ 'get_callback' ] ) {
319 319
 				continue;
320 320
 			}
321 321
 
322
-			$object[ $field_name ] = call_user_func( $field_options['get_callback'], $object, $field_name, $request, $this->get_object_type() );
322
+			$object[ $field_name ] = call_user_func( $field_options[ 'get_callback' ], $object, $field_name, $request, $this->get_object_type() );
323 323
 		}
324 324
 
325 325
 		return $object;
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 
338 338
 		foreach ( $additional_fields as $field_name => $field_options ) {
339 339
 
340
-			if ( ! $field_options['update_callback'] ) {
340
+			if ( ! $field_options[ 'update_callback' ] ) {
341 341
 				continue;
342 342
 			}
343 343
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 				continue;
347 347
 			}
348 348
 
349
-			call_user_func( $field_options['update_callback'], $request[ $field_name ], $object, $field_name, $request, $this->get_object_type() );
349
+			call_user_func( $field_options[ 'update_callback' ], $request[ $field_name ], $object, $field_name, $request, $this->get_object_type() );
350 350
 		}
351 351
 	}
352 352
 
@@ -358,23 +358,23 @@  discard block
 block discarded – undo
358 358
 	 * @param array $schema Schema array.
359 359
 	 */
360 360
 	protected function add_additional_fields_schema( $schema ) {
361
-		if ( empty( $schema['title'] ) ) {
361
+		if ( empty( $schema[ 'title' ] ) ) {
362 362
 			return $schema;
363 363
 		}
364 364
 
365 365
 		/**
366 366
 		 * Can't use $this->get_object_type otherwise we cause an inf loop.
367 367
 		 */
368
-		$object_type = $schema['title'];
368
+		$object_type = $schema[ 'title' ];
369 369
 
370 370
 		$additional_fields = $this->get_additional_fields( $object_type );
371 371
 
372 372
 		foreach ( $additional_fields as $field_name => $field_options ) {
373
-			if ( ! $field_options['schema'] ) {
373
+			if ( ! $field_options[ 'schema' ] ) {
374 374
 				continue;
375 375
 			}
376 376
 
377
-			$schema['properties'][ $field_name ] = $field_options['schema'];
377
+			$schema[ 'properties' ][ $field_name ] = $field_options[ 'schema' ];
378 378
 		}
379 379
 
380 380
 		return $schema;
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 	protected function get_object_type() {
414 414
 		$schema = $this->get_item_schema();
415 415
 
416
-		if ( ! $schema || ! isset( $schema['title'] ) ) {
416
+		if ( ! $schema || ! isset( $schema[ 'title' ] ) ) {
417 417
 			return null;
418 418
 		}
419 419
 
420
-		return $schema['title'];
420
+		return $schema[ 'title' ];
421 421
 	}
422 422
 
423 423
 	/**
@@ -433,13 +433,13 @@  discard block
 block discarded – undo
433 433
 	public function get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE ) {
434 434
 
435 435
 		$schema                = $this->get_item_schema();
436
-		$schema_properties     = ! empty( $schema['properties'] ) ? $schema['properties'] : array();
436
+		$schema_properties     = ! empty( $schema[ 'properties' ] ) ? $schema[ 'properties' ] : array();
437 437
 		$endpoint_args = array();
438 438
 
439 439
 		foreach ( $schema_properties as $field_id => $params ) {
440 440
 
441 441
 			// Arguments specified as `readonly` are not allowed to be set.
442
-			if ( ! empty( $params['readonly'] ) ) {
442
+			if ( ! empty( $params[ 'readonly' ] ) ) {
443 443
 				continue;
444 444
 			}
445 445
 
@@ -448,16 +448,16 @@  discard block
 block discarded – undo
448 448
 				'sanitize_callback' => 'rest_sanitize_request_arg',
449 449
 			);
450 450
 
451
-			if ( isset( $params['description'] ) ) {
452
-				$endpoint_args[ $field_id ]['description'] = $params['description'];
451
+			if ( isset( $params[ 'description' ] ) ) {
452
+				$endpoint_args[ $field_id ][ 'description' ] = $params[ 'description' ];
453 453
 			}
454 454
 
455
-			if ( WP_REST_Server::CREATABLE === $method && isset( $params['default'] ) ) {
456
-				$endpoint_args[ $field_id ]['default'] = $params['default'];
455
+			if ( WP_REST_Server::CREATABLE === $method && isset( $params[ 'default' ] ) ) {
456
+				$endpoint_args[ $field_id ][ 'default' ] = $params[ 'default' ];
457 457
 			}
458 458
 
459
-			if ( WP_REST_Server::CREATABLE === $method && ! empty( $params['required'] ) ) {
460
-				$endpoint_args[ $field_id ]['required'] = true;
459
+			if ( WP_REST_Server::CREATABLE === $method && ! empty( $params[ 'required' ] ) ) {
460
+				$endpoint_args[ $field_id ][ 'required' ] = true;
461 461
 			}
462 462
 
463 463
 			foreach ( array( 'type', 'format', 'enum' ) as $schema_prop ) {
@@ -467,14 +467,14 @@  discard block
 block discarded – undo
467 467
 			}
468 468
 
469 469
 			// Merge in any options provided by the schema property.
470
-			if ( isset( $params['arg_options'] ) ) {
470
+			if ( isset( $params[ 'arg_options' ] ) ) {
471 471
 
472 472
 				// Only use required / default from arg_options on CREATABLE endpoints.
473 473
 				if ( WP_REST_Server::CREATABLE !== $method ) {
474
-					$params['arg_options'] = array_diff_key( $params['arg_options'], array( 'required' => '', 'default' => '' ) );
474
+					$params[ 'arg_options' ] = array_diff_key( $params[ 'arg_options' ], array( 'required' => '', 'default' => '' ) );
475 475
 				}
476 476
 
477
-				$endpoint_args[ $field_id ] = array_merge( $endpoint_args[ $field_id ], $params['arg_options'] );
477
+				$endpoint_args[ $field_id ] = array_merge( $endpoint_args[ $field_id ], $params[ 'arg_options' ] );
478 478
 			}
479 479
 		}
480 480
 
Please login to merge, or discard this patch.