<?php
/**
 * Transforms an array into list elements.
 *
 * @package EaLab\WP_Deployer
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Transforms an array into list elements.
 *
 * @param array $items The array to transform.
 *
 * @return string Markup.
 */
function deploy_sync_content__array_to_li( array $items = array() ): string {
	if ( empty( $items ) ) {
		return '';
	}

	$list_items = array_map(
		function ( $item ) {
			return '<li>' . esc_html( $item ) . '</li>';
		},
		$items
	);

	return implode( '', $list_items );
}
