# tier-pricing-table/8.0.2/src/Addons/GlobalTieredPricing/Formatter.php

Tiered Pricing Table for WooCommerce, version 8.0.2. 36 lines.

- Page: https://pluginprobe.com/plugins/tier-pricing-table/8.0.2/code/src/Addons/GlobalTieredPricing/Formatter.php
- Raw: https://pluginprobe.com/plugins/tier-pricing-table/8.0.2/raw/src/Addons/GlobalTieredPricing/Formatter.php
- Modified: 2022-12-28T23:00:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/tier-pricing-table/8.0.2/code/src/Addons/GlobalTieredPricing/Formatter.php#L10-L20`.

```php
<?php namespace TierPricingTable\Addons\GlobalTieredPricing;

use WC_Customer;

class Formatter {

	public static function formatCustomerString( WC_Customer $customer, $link = false ) {
		$firstName = $customer->get_billing_first_name() ? $customer->get_billing_first_name() : $customer->get_shipping_first_name();
		$lastName  = $customer->get_billing_last_name() ? $customer->get_billing_last_name() : $customer->get_shipping_last_name();
		$email     = $customer->get_billing_email() ? $customer->get_billing_email() : $customer->get_email();

		if ( ! $email ) {
			return 'Undefined';
		}

		$name = sprintf( '%s %s (%s)', $firstName, $lastName, $email );

		if ( $link ) {
			return sprintf( '<a href="%s">%s</a>', get_edit_user_link( $customer->get_id() ), $name );
		}

		return $name;
	}

	public static function formatRoleString( $roleSlug ) {
		$roles = wp_roles()->roles;

		if ( array_key_exists( $roleSlug, $roles ) ) {
			return $roles[ $roleSlug ]['name'];
		}

		return 'Undefined role';
	}

}

```
