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
Pull Request — develop (#42)
by Chris
01:59
created
inc/game/namespace.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 			],
51 51
 		],
52 52
 		// Dropdown filters.
53
-		'admin_filters'       => [],
53
+		'admin_filters'       => [ ],
54 54
 		], [
55 55
 			'singular'      => __( 'Game', 'games-collector' ),
56 56
 			'plural'        => __( 'Games', 'games-collector' ),
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 		'id'            => $prefix . 'metabox',
72 72
 		'title'         => __( 'Game Details', 'games-collector' ),
73 73
 		'object_types'  => [ 'gc_game' ],
74
-	]);
74
+	] );
75 75
 
76
-	$cmb->add_field([
76
+	$cmb->add_field( [
77 77
 		'name'       => __( 'Minimum Number of Players', 'games-collector' ),
78 78
 		'id'         => $prefix . 'min_players',
79 79
 		'type'       => 'text_small',
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 			'type'        => 'number',
82 82
 			'placeholder' => '1',
83 83
 		],
84
-	]);
84
+	] );
85 85
 
86
-	$cmb->add_field([
86
+	$cmb->add_field( [
87 87
 		'name'       => __( 'Maximum Number of Players', 'games-collector' ),
88 88
 		'id'         => $prefix . 'max_players',
89 89
 		'type'       => 'text_small',
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 			'type'        => 'number',
92 92
 			'placeholder' => '4',
93 93
 		],
94
-	]);
94
+	] );
95 95
 
96
-	$cmb->add_field([
96
+	$cmb->add_field( [
97 97
 		'name'       => __( 'Playing Time', 'games-collector' ),
98 98
 		'id'         => $prefix . 'time',
99 99
 		'type'       => 'text_small',
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 		'attributes' => [
102 102
 			'placeholder' => '20-30',
103 103
 		],
104
-	]);
104
+	] );
105 105
 
106
-	$cmb->add_field([
106
+	$cmb->add_field( [
107 107
 		'name'       => __( 'Ages', 'games-collector' ),
108 108
 		'id'         => $prefix . 'age',
109 109
 		'type'       => 'text_small',
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
 			'type'        => 'number',
113 113
 			'placeholder' => '10',
114 114
 		],
115
-	]);
115
+	] );
116 116
 
117
-	$cmb->add_field([
117
+	$cmb->add_field( [
118 118
 		'name'       => __( 'Difficulty Level', 'games-collector' ),
119 119
 		'id'         => $prefix . 'difficulty',
120 120
 		'type'       => 'radio',
121 121
 		'desc'       => __( 'How difficult or complex is this game?', 'games-collector' ),
122 122
 		'options'    => get_difficulties(),
123 123
 		'default'    => 'easy',
124
-	]);
124
+	] );
125 125
 
126 126
 	$cmb->add_field( array(
127 127
 		'name'       => __( 'More Info Link', 'games-collector' ),
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 
150 150
 	$players_min_max = get_players_min_max( $post_id );
151 151
 
152
-	if ( isset( $players_min_max['min'] ) && isset( $players_min_max['max'] ) ) {
153
-		return sprintf( '%1$s - %2$s', $players_min_max['min'], $players_min_max['max'] );
152
+	if ( isset( $players_min_max[ 'min' ] ) && isset( $players_min_max[ 'max' ] ) ) {
153
+		return sprintf( '%1$s - %2$s', $players_min_max[ 'min' ], $players_min_max[ 'max' ] );
154 154
 	}
155 155
 
156 156
 	return;
@@ -292,20 +292,20 @@  discard block
 block discarded – undo
292 292
 	$difficulty = get_post_meta( $post_id, '_gc_difficulty', true );
293 293
 	$length     = get_game_length( $post_id );
294 294
 
295
-	if ( isset( $players['min'] ) ) {
296
-		$classes .= ' min-' . $players['min'] . '-players';
295
+	if ( isset( $players[ 'min' ] ) ) {
296
+		$classes .= ' min-' . $players[ 'min' ] . '-players';
297 297
 	}
298 298
 
299
-	if ( isset( $players['max'] ) ) {
300
-		if ( absint( $players['max'] ) >= 8 ) {
299
+	if ( isset( $players[ 'max' ] ) ) {
300
+		if ( absint( $players[ 'max' ] ) >= 8 ) {
301 301
 			$classes .= ' 8-or-more-players';
302 302
 		} else {
303
-			$classes .= ' max-' . $players['max'] . '-players';
303
+			$classes .= ' max-' . $players[ 'max' ] . '-players';
304 304
 		}
305 305
 	}
306 306
 
307
-	if ( isset( $players['min'] ) && ! isset( $players['max'] ) ) {
308
-		$classes .= ' ' . $players['min'] . '-players';
307
+	if ( isset( $players[ 'min' ] ) && ! isset( $players[ 'max' ] ) ) {
308
+		$classes .= ' ' . $players[ 'min' ] . '-players';
309 309
 	}
310 310
 
311 311
 	if ( $age ) {
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 
342 342
 	$game_time = str_replace( ' ', '', get_post_meta( $post_id, '_gc_time', true ) );
343 343
 	$time      = explode( '-', $game_time );
344
-	$time      = isset( $time[1] ) ? $time[1] : $time[0];
344
+	$time      = isset( $time[ 1 ] ) ? $time[ 1 ] : $time[ 0 ];
345 345
 
346 346
 	if ( $game_time ) {
347 347
 		switch ( $time ) {
Please login to merge, or discard this patch.
inc/namespace.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function activate() {
42 42
 	if ( ! get_page_by_title( esc_html__( 'Games', 'games-collector' ) ) ) {
43
-		wp_insert_post([
43
+		wp_insert_post( [
44 44
 			'post_type'    => 'page',
45 45
 			'post_title'   => esc_html__( 'Games', 'games-collector' ),
46 46
 			'post_content' => '[games-collector]',
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 function numbers_of_players( $game_id, $players_min_max, $output ) {
64 64
 
65 65
 	// Deal with max number of players matching min number of players.
66
-	if ( absint( $players_min_max['min'] ) === absint( $players_min_max['max'] ) ) {
66
+	if ( absint( $players_min_max[ 'min' ] ) === absint( $players_min_max[ 'max' ] ) ) {
67 67
 		return esc_attr( sprintf(
68 68
 			// Translators: %d is the number of players.
69
-			_n( '%d player', '%d players', absint( $players_min_max['min'] ), 'games-collector' ),
70
-			absint( $players_min_max['min'] )
69
+			_n( '%d player', '%d players', absint( $players_min_max[ 'min' ] ), 'games-collector' ),
70
+			absint( $players_min_max[ 'min' ] )
71 71
 		) );
72 72
 	}
73 73
 
74 74
 	// Deal with indeterminate or large number of max players.
75
-	if ( 0 === absint( $players_min_max['max'] ) || 20 <= absint( $players_min_max['max'] ) ) {
75
+	if ( 0 === absint( $players_min_max[ 'max' ] ) || 20 <= absint( $players_min_max[ 'max' ] ) ) {
76 76
 		return esc_attr( sprintf(
77 77
 			// Translators: %d is the minimum number players.
78 78
 			__( '%d+ players', 'games-collector' ),
79
-			absint( $players_min_max['min'] )
79
+			absint( $players_min_max[ 'min' ] )
80 80
 		) );
81 81
 	}
82 82
 
Please login to merge, or discard this patch.
inc/bgg/namespace.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
  */
71 71
 function get_bgg_search_results( $query ) {
72 72
 	$response = wp_remote_get( bgg_search( $query ) );
73
-	$results  = [];
73
+	$results  = [ ];
74 74
 
75
-	if ( isset( $response['response'] ) && 200 === $response['response']['code'] ) {
76
-		$xml  = simplexml_load_string( wp_remote_retrieve_body( $response ) );
75
+	if ( isset( $response[ 'response' ] ) && 200 === $response[ 'response' ][ 'code' ] ) {
76
+		$xml = simplexml_load_string( wp_remote_retrieve_body( $response ) );
77 77
 
78 78
 		if ( isset( $xml->boardgame ) ) {
79 79
 			foreach ( $xml->boardgame as $game ) {
80 80
 				$game = (array) $game;
81 81
 
82
-				$results[] = [
83
-					'id'   => ( isset( $game['@attributes']['objectid'] ) ) ? (int) $game['@attributes']['objectid'] : '',
84
-					'name' => ( isset( $game['name'] ) ) ? $game['name'] : '',
85
-					'year' => ( isset( $game['yearpublished'] ) ) ? $game['yearpublished'] : '',
82
+				$results[ ] = [
83
+					'id'   => ( isset( $game[ '@attributes' ][ 'objectid' ] ) ) ? (int) $game[ '@attributes' ][ 'objectid' ] : '',
84
+					'name' => ( isset( $game[ 'name' ] ) ) ? $game[ 'name' ] : '',
85
+					'year' => ( isset( $game[ 'yearpublished' ] ) ) ? $game[ 'yearpublished' ] : '',
86 86
 				];
87 87
 			}
88 88
 		}
@@ -100,31 +100,31 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function get_bgg_game( $id ) {
102 102
 	$response = wp_remote_get( bgg_game( $id ) );
103
-	$data     = [];
103
+	$data     = [ ];
104 104
 
105
-	if ( isset( $response['response'] ) && 200 === $response['response']['code'] ) {
105
+	if ( isset( $response[ 'response' ] ) && 200 === $response[ 'response' ][ 'code' ] ) {
106 106
 		$xml = simplexml_load_string( wp_remote_retrieve_body( $response ) );
107 107
 		$game = $xml->item;
108 108
 		$data = [
109
-			'title'       => (string) $game->name->attributes()['value'],
109
+			'title'       => (string) $game->name->attributes()[ 'value' ],
110 110
 			'image'       => (string) $game->image,
111
-			'minplayers'  => (int) $game->minplayers->attributes()['value'],
112
-			'maxplayers'  => (int) $game->maxplayers->attributes()['value'],
113
-			'minplaytime' => (int) $game->minplaytime->attributes()['value'],
114
-			'maxplaytime' => (int) $game->maxplaytime->attributes()['value'],
115
-			'minage'      => (int) $game->minage->attributes()['value'],
116
-			'categories'  => [],
111
+			'minplayers'  => (int) $game->minplayers->attributes()[ 'value' ],
112
+			'maxplayers'  => (int) $game->maxplayers->attributes()[ 'value' ],
113
+			'minplaytime' => (int) $game->minplaytime->attributes()[ 'value' ],
114
+			'maxplaytime' => (int) $game->maxplaytime->attributes()[ 'value' ],
115
+			'minage'      => (int) $game->minage->attributes()[ 'value' ],
116
+			'categories'  => [ ],
117 117
 		];
118 118
 
119
-		$categories = [];
119
+		$categories = [ ];
120 120
 
121 121
 		foreach ( $game->link as $metadata ) {
122
-			if ( 'boardgamecategory' === (string) $metadata->attributes()['type'] ) {
123
-				$categories[] = (string) $metadata->attributes()['value'];
122
+			if ( 'boardgamecategory' === (string) $metadata->attributes()[ 'type' ] ) {
123
+				$categories[ ] = (string) $metadata->attributes()[ 'value' ];
124 124
 			}
125 125
 		}
126 126
 
127
-		$data['categories'] = ! empty( $categories ) ? $categories : [];
127
+		$data[ 'categories' ] = ! empty( $categories ) ? $categories : [ ];
128 128
 	}
129 129
 
130 130
 	return $data;
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 	$search_results = get_transient( 'gc_last_bgg_search' );
140 140
 
141 141
 	// First run.
142
-	if ( ! $search_results || isset( $_GET['reset_search'] ) ) {
142
+	if ( ! $search_results || isset( $_GET[ 'reset_search' ] ) ) {
143 143
 
144 144
 		// If we're clearing the search, delete the transient and start over.
145
-		if ( isset( $_GET['bgg_search_reset_nonce'] ) &&
146
-			wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['bgg_search_reset_nonce'] ) ), 'bgg_search_reset_nonce' ) ) {
145
+		if ( isset( $_GET[ 'bgg_search_reset_nonce' ] ) &&
146
+			wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET[ 'bgg_search_reset_nonce' ] ) ), 'bgg_search_reset_nonce' ) ) {
147 147
 			delete_transient( 'gc_last_bgg_search' );
148 148
 			add_action( 'admin_notices', __NAMESPACE__ . '\\search_cleared_notice' );
149 149
 		}
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
  * @param  object $field_type_object The CMB2 field type object.
213 213
  */
214 214
 function render_cmb2_bgg_search( $field, $escaped_value, $object_id, $object_type, $field_type_object ) {
215
-	$description = '<p class="description">' . esc_html( $field_type_object->field->args()['desc'] ) . '</p>';
215
+	$description = '<p class="description">' . esc_html( $field_type_object->field->args()[ 'desc' ] ) . '</p>';
216 216
 	$form = sprintf( '<input id="%1$s" class="regular-text" name="%2$s" value="" placeholder="%3$s" type="text">',
217
-		esc_attr( $field_type_object->field->args()['id'] ),
218
-		esc_attr( $field_type_object->field->args()['id'] ),
217
+		esc_attr( $field_type_object->field->args()[ 'id' ] ),
218
+		esc_attr( $field_type_object->field->args()[ 'id' ] ),
219 219
 		__( 'A game title or search, e.g. &ldquo;betrayal house hill&rdquo;', 'usat' )
220 220
 	);
221 221
 	$hidden = '<input type="hidden" name="action" value="bgg_search_response">';
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
 
224 224
 	echo wp_kses( $output, [
225 225
 		'p'     => [
226
-			'class'       => [],
226
+			'class'       => [ ],
227 227
 		],
228 228
 		'input' => [
229
-			'id'          => [],
230
-			'class'       => [],
231
-			'name'        => [],
232
-			'value'       => [],
233
-			'type'        => [],
234
-			'placeholder' => [],
229
+			'id'          => [ ],
230
+			'class'       => [ ],
231
+			'name'        => [ ],
232
+			'value'       => [ ],
233
+			'type'        => [ ],
234
+			'placeholder' => [ ],
235 235
 		],
236 236
 	] );
237 237
 }
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	?>
263 263
 	<a href="<?php echo esc_url_raw( $url ); ?>">
264 264
 		<div class="button alignright" name="bgg_search_reset">
265
-			<?php echo esc_html( $field_type_object->field->args['button_name'] ); ?>
265
+			<?php echo esc_html( $field_type_object->field->args[ 'button_name' ] ); ?>
266 266
 		</div>
267 267
 	</a>
268 268
 	<input type="hidden" name="action" value="bgg_search_reset" />
@@ -270,17 +270,17 @@  discard block
 block discarded – undo
270 270
 
271 271
 	echo wp_kses( ob_get_clean(), [
272 272
 		'a' => [
273
-			'href' => [],
273
+			'href' => [ ],
274 274
 		],
275 275
 		'div' => [
276
-			'class' => [],
276
+			'class' => [ ],
277 277
 		],
278 278
 		'input' => [
279
-			'type'  => [],
280
-			'name'  => [],
281
-			'value' => [],
279
+			'type'  => [ ],
280
+			'name'  => [ ],
281
+			'value' => [ ],
282 282
 		],
283
-	]);
283
+	] );
284 284
 }
285 285
 
286 286
 /**
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
  * @return void|wp_die
291 291
  */
292 292
 function search_response() {
293
-	if ( isset( $_POST['nonce_CMB2phpbgg-search'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce_CMB2phpbgg-search'] ) ), 'nonce_CMB2phpbgg-search' ) ) {
293
+	if ( isset( $_POST[ 'nonce_CMB2phpbgg-search' ] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST[ 'nonce_CMB2phpbgg-search' ] ) ), 'nonce_CMB2phpbgg-search' ) ) {
294 294
 
295
-		$search_query = isset( $_POST['bgg_searchform'] ) ? sanitize_text_field( wp_unslash( $_POST['bgg_searchform'] ) ) : '';
295
+		$search_query = isset( $_POST[ 'bgg_searchform' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'bgg_searchform' ] ) ) : '';
296 296
 		$results      = get_bgg_search_results( $search_query );
297 297
 		set_transient( 'gc_last_bgg_search', $results, HOUR_IN_SECONDS );
298 298
 		wp_safe_redirect( admin_url( 'edit.php?post_type=gc_game&page=add_from_bgg&step=2' ) );
@@ -330,14 +330,14 @@  discard block
 block discarded – undo
330 330
 	global $submenu;
331 331
 
332 332
 	// Store the Games Collector menu to a variable.
333
-	$items = $submenu['edit.php?post_type=gc_game'];
333
+	$items = $submenu[ 'edit.php?post_type=gc_game' ];
334 334
 
335 335
 	// Item 11 is right after Add New. Item 16 is the link for Add New from BGG.
336
-	$submenu['edit.php?post_type=gc_game'][11] = $items[16]; // WPCS: override ok.
336
+	$submenu[ 'edit.php?post_type=gc_game' ][ 11 ] = $items[ 16 ]; // WPCS: override ok.
337 337
 	// Remove item 16, the old Add New from BGG link.
338
-	unset( $submenu['edit.php?post_type=gc_game'][16] );
338
+	unset( $submenu[ 'edit.php?post_type=gc_game' ][ 16 ] );
339 339
 	// Re-sort the menu by index.
340
-	ksort( $submenu['edit.php?post_type=gc_game'] );
340
+	ksort( $submenu[ 'edit.php?post_type=gc_game' ] );
341 341
 
342 342
 	return $menu_order;
343 343
 }
@@ -350,12 +350,12 @@  discard block
 block discarded – undo
350 350
  * @return array          An array of options for CMB2.
351 351
  */
352 352
 function bgg_search_results_options( $results ) {
353
-	$options = [];
353
+	$options = [ ];
354 354
 	foreach ( $results as $game ) {
355
-		$options[ absint( $game['id'] ) ] = sprintf( '%1$s [%2$s] (%3$s)',
356
-			'<strong>' . esc_html( $game['name'] ) . '</strong>',
357
-			esc_html( $game['year'] ),
358
-			esc_html( $game['id'] )
355
+		$options[ absint( $game[ 'id' ] ) ] = sprintf( '%1$s [%2$s] (%3$s)',
356
+			'<strong>' . esc_html( $game[ 'name' ] ) . '</strong>',
357
+			esc_html( $game[ 'year' ] ),
358
+			esc_html( $game[ 'id' ] )
359 359
 		);
360 360
 	}
361 361
 
@@ -369,16 +369,16 @@  discard block
 block discarded – undo
369 369
  * @return void|wp_die
370 370
  */
371 371
 function insert_game() {
372
-	if ( isset( $_POST['nonce_CMB2phpbgg-search-2'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce_CMB2phpbgg-search-2'] ) ), 'nonce_CMB2phpbgg-search-2' ) ) {
372
+	if ( isset( $_POST[ 'nonce_CMB2phpbgg-search-2' ] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST[ 'nonce_CMB2phpbgg-search-2' ] ) ), 'nonce_CMB2phpbgg-search-2' ) ) {
373 373
 
374
-		$game_id      = isset( $_POST['bgg_search_results'] ) ? absint( wp_unslash( $_POST['bgg_search_results'] ) ) : false;
374
+		$game_id      = isset( $_POST[ 'bgg_search_results' ] ) ? absint( wp_unslash( $_POST[ 'bgg_search_results' ] ) ) : false;
375 375
 		$redirect_url = admin_url( 'edit.php?post_type=gc_game&page=add_from_bgg' );
376 376
 
377 377
 		if ( $game_id ) {
378 378
 			$game = get_bgg_game( $game_id );
379 379
 
380 380
 			// Check if game already exists.
381
-			if ( get_page_by_title( $game['title'], OBJECT, 'gc_game' ) ) {
381
+			if ( get_page_by_title( $game[ 'title' ], OBJECT, 'gc_game' ) ) {
382 382
 				return wp_die(
383 383
 					esc_html__( 'A game with that title already exists. Please try again.', 'games-collector' ),
384 384
 					esc_html__( 'Duplicate game found', 'games-collector' ),
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
 			$post_id = wp_insert_post( [
390 390
 				'post_type'   => 'gc_game',
391
-				'post_title'  => esc_html( $game['title'] ),
391
+				'post_title'  => esc_html( $game[ 'title' ] ),
392 392
 				'post_status' => 'draft',
393 393
 			] );
394 394
 
@@ -396,20 +396,20 @@  discard block
 block discarded – undo
396 396
 				$redirect_url = admin_url( sprintf( 'post.php?post=%d&action=edit', $post_id ) );
397 397
 
398 398
 				// Add game meta.
399
-				add_post_meta( $post_id, '_gc_min_players', absint( $game['minplayers'] ) );
400
-				add_post_meta( $post_id, '_gc_max_players', absint( $game['maxplayers'] ) );
401
-				add_post_meta( $post_id, '_gc_age', absint( $game['minage'] ) );
399
+				add_post_meta( $post_id, '_gc_min_players', absint( $game[ 'minplayers' ] ) );
400
+				add_post_meta( $post_id, '_gc_max_players', absint( $game[ 'maxplayers' ] ) );
401
+				add_post_meta( $post_id, '_gc_age', absint( $game[ 'minage' ] ) );
402 402
 				add_post_meta( $post_id, '_gc_link', sprintf( 'https://www.boardgamegeek.com/boardgame/%d/', $game_id ) );
403 403
 				add_post_meta( $post_id, '_gc_bgg_id', $game_id );
404 404
 
405
-				if ( absint( $game['minplaytime'] ) === absint( $game['maxplaytime'] ) ) {
406
-					add_post_meta( $post_id, '_gc_time', esc_html( $game['minplaytime'] ) );
405
+				if ( absint( $game[ 'minplaytime' ] ) === absint( $game[ 'maxplaytime' ] ) ) {
406
+					add_post_meta( $post_id, '_gc_time', esc_html( $game[ 'minplaytime' ] ) );
407 407
 				} else {
408
-					add_post_meta( $post_id, '_gc_time', esc_html( $game['minplaytime'] . '-' . $game['maxplaytime'] ) );
408
+					add_post_meta( $post_id, '_gc_time', esc_html( $game[ 'minplaytime' ] . '-' . $game[ 'maxplaytime' ] ) );
409 409
 				}
410 410
 
411
-				if ( isset( $game['categories'] ) ) {
412
-					foreach ( $game['categories'] as $game_attribute ) {
411
+				if ( isset( $game[ 'categories' ] ) ) {
412
+					foreach ( $game[ 'categories' ] as $game_attribute ) {
413 413
 						$similar_attribute = get_attribute_like( $game_attribute );
414 414
 
415 415
 						// If there's an existing attribute that matches the BGG category, use that.
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 		return $cached_term_search[ $search ];
456 456
 	}
457 457
 
458
-	$terms     = [];
458
+	$terms     = [ ];
459 459
 	$all_terms = get_terms( [
460 460
 		'taxonomy' => 'gc_attribute',
461 461
 		'hide_empty' => false,
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	foreach ( $all_terms as $term ) {
465 465
 		similar_text( $term->name, $search, $similarity );
466 466
 		if ( $similarity > 75 ) {
467
-			$terms[] = $term->term_id;
467
+			$terms[ ] = $term->term_id;
468 468
 		}
469 469
 	}
470 470
 
@@ -473,14 +473,14 @@  discard block
 block discarded – undo
473 473
 		// Cache this term combination so we can access it faster later.
474 474
 		if ( ! $cached_term_search ) {
475 475
 			set_transient( 'gc_frequently_used_attributes', [
476
-				$search => $terms[0],
476
+				$search => $terms[ 0 ],
477 477
 			], 999 * YEAR_IN_SECONDS );
478 478
 		} else {
479
-			$cached_term_search = array_merge( $cached_term_search, [ $search => $terms[0] ] );
479
+			$cached_term_search = array_merge( $cached_term_search, [ $search => $terms[ 0 ] ] );
480 480
 			set_transient( 'gc_frequently_used_attributes', $cached_term_search, 999 * YEAR_IN_SECONDS );
481 481
 		}
482 482
 
483
-		return $terms[0];
483
+		return $terms[ 0 ];
484 484
 	}
485 485
 
486 486
 	return false;
@@ -494,6 +494,6 @@  discard block
 block discarded – undo
494 494
  * @param  array $game    The array of game data from BGG.
495 495
  */
496 496
 function attach_bgg_image( $post_id, $game ) {
497
-	$image_id = media_sideload_image( esc_url_raw( $game['image'] ), $post_id, esc_html( $game['title'] ), 'id' );
497
+	$image_id = media_sideload_image( esc_url_raw( $game[ 'image' ] ), $post_id, esc_html( $game[ 'title' ] ), 'id' );
498 498
 	set_post_thumbnail( $post_id, $image_id );
499 499
 }
Please login to merge, or discard this patch.