Code Duplication    Length = 10-13 lines in 2 locations

includes/admin/shortcodes/abstract-shortcode-generator.php 1 location

@@ 297-309 (lines=13) @@
294
		$posts   = get_posts( $args );
295
		$options = array();
296
297
		if ( ! empty( $posts ) ) {
298
			foreach ( $posts as $post ) {
299
				$options[ absint( $post->ID ) ] = empty( $post->post_title )
300
					? sprintf( __( 'Untitled (#%s)', 'give' ), $post->ID )
301
					/** This filter is documented in wp-includes/post-template.php */
302
					: apply_filters( 'the_title', $post->post_title, $post->ID );
303
			}
304
305
			$field['type']    = 'listbox';
306
			$field['options'] = $options;
307
308
			return $this->generate_listbox( $field );
309
		}
310
311
		// perform validation here before returning false
312
		$this->validate( $field );

includes/admin/class-give-html-elements.php 1 location

@@ 195-204 (lines=10) @@
192
		}
193
194
		$options[0] = esc_html__( 'No forms found.', 'give' );
195
		if ( ! empty( $forms ) ) {
196
			$options[0] = $args['placeholder'];
197
			foreach ( $forms as $form ) {
198
				$form_title = empty( $form->post_title )
199
					? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID )
200
					: $form->post_title;
201
202
				$options[ absint( $form->ID ) ] = esc_html( $form_title );
203
			}
204
		}
205
206
		$output = $this->select( array(
207
			'name'             => $args['name'],