Code Duplication    Length = 11-11 lines in 3 locations

core/Field/Association_Field.php 3 locations

@@ 258-268 (lines=11) @@
255
256
				// fetch and prepare terms as relationship items
257
				$terms = get_terms( $type['taxonomy'], $args );
258
				foreach ( $terms as $term_id => &$term ) {
259
					$term = array(
260
						'id' => $term_id,
261
						'title' => $term,
262
						'type' => $type['type'],
263
						'subtype' => $type['taxonomy'],
264
						'label' => $this->get_item_label( $term_id, $type['type'], $type['taxonomy'] ),
265
						'is_trashed' => false,
266
						'edit_link' => $this->get_object_edit_link( $type, $term_id ),
267
					);
268
				}
269
				$options = array_merge( $options, $terms );
270
271
			} elseif ( $type['type'] === 'user' ) { // populate users
@@ 285-295 (lines=11) @@
282
283
				// fetch and prepare users as relationship items
284
				$users = get_users( $args );
285
				foreach ( $users as &$u ) {
286
					$u = array(
287
						'id' => $u,
288
						'title' => $this->get_title_by_type( $u, $type['type'] ),
289
						'type' => $type['type'],
290
						'subtype' => 'user',
291
						'label' => $this->get_item_label( $u, $type['type'] ),
292
						'is_trashed' => false,
293
						'edit_link' => $this->get_object_edit_link( $type, $u ),
294
					);
295
				}
296
				$options = array_merge( $options, $users );
297
298
			} elseif ( $type['type'] === 'comment' ) { // populate comments
@@ 312-322 (lines=11) @@
309
310
				// fetch and prepare comments as relationship items
311
				$comments = get_comments( $args );
312
				foreach ( $comments as &$c ) {
313
					$c = array(
314
						'id' => $c,
315
						'title' => $this->get_title_by_type( $c, $type['type'] ),
316
						'type' => $type['type'],
317
						'subtype' => 'comment',
318
						'label' => $this->get_item_label( $c, $type['type'] ),
319
						'is_trashed' => false,
320
						'edit_link' => $this->get_object_edit_link( $type, $c ),
321
					);
322
				}
323
				$options = array_merge( $options, $comments );
324
325
			}