PHP 8.2.31
Preview: Meta.php Size: 1.34 KB
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/woocommerce/src/Internal/OrderReviews/Meta.php

<?php
declare( strict_types = 1 );

namespace Automattic\WooCommerce\Internal\OrderReviews;

use WC_Order;

/**
 * Shared meta-line helpers for Review Order templates.
 */
class Meta {

	/**
	 * Build the meta-line parts shown above the heading on both the form and
	 * empty-state views (customer name, billing email, order #/date).
	 *
	 * @param WC_Order $order Order being reviewed.
	 * @return array<int, string> Non-empty parts ready to be joined with a separator.
	 */
	public static function parts_for_order( WC_Order $order ): array {
		$date_created    = $order->get_date_created();
		$customer_name   = trim( $order->get_billing_first_name() . ' ' . $order->get_billing_last_name() );
		$customer_email  = $order->get_billing_email();
		$order_number    = $order->get_order_number();
		$order_date_text = $date_created ? wc_format_datetime( $date_created ) : '';

		if ( '' !== $order_date_text ) {
			$order_summary = sprintf(
				/* translators: 1: order number, 2: order date */
				__( 'Order #%1$s (%2$s)', 'woocommerce' ),
				$order_number,
				$order_date_text
			);
		} else {
			$order_summary = sprintf(
				/* translators: %s: order number */
				__( 'Order #%s', 'woocommerce' ),
				$order_number
			);
		}

		return array_values(
			array_filter(
				array(
					$customer_name,
					$customer_email,
					$order_summary,
				)
			)
		);
	}
}

Directory Contents

Dirs: 0 × Files: 6

Name Size Perms Modified Actions
27.62 KB lrw-r--r-- 2026-05-25 14:01:26
Edit Download
9.64 KB lrw-r--r-- 2026-05-25 14:01:26
Edit Download
1.34 KB lrw-r--r-- 2026-05-25 14:01:26
Edit Download
7.30 KB lrw-r--r-- 2026-05-25 14:01:26
Edit Download
2.88 KB lrw-r--r-- 2026-05-11 17:17:08
Edit Download
13.65 KB lrw-r--r-- 2026-05-25 14:01:26
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).