PHP 8.2.31
Preview: Formatters.php Size: 1.21 KB
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/woocommerce/src/StoreApi/Formatters.php

<?php
namespace Automattic\WooCommerce\StoreApi;

use \Exception;
use Automattic\WooCommerce\StoreApi\Formatters\DefaultFormatter;

/**
 * Formatters class.
 *
 * Allows formatter classes to be registered. Formatters are exposed to extensions via the ExtendSchema class.
 */
class Formatters {
	/**
	 * Holds an array of formatter class instances.
	 *
	 * @var array
	 */
	private $formatters = [];

	/**
	 * Get a new instance of a formatter class.
	 *
	 * @throws Exception An Exception is thrown if a non-existing formatter is used and the user is admin.
	 *
	 * @param string $name Name of the formatter.
	 * @return FormatterInterface Formatter class instance.
	 */
	public function __get( $name ) {
		if ( ! isset( $this->formatters[ $name ] ) ) {
			if ( defined( 'WP_DEBUG' ) && WP_DEBUG && current_user_can( 'manage_woocommerce' ) ) {
				throw new Exception( $name . ' formatter does not exist' );
			}
			return new DefaultFormatter();
		}
		return $this->formatters[ $name ];
	}

	/**
	 * Register a formatter class for usage.
	 *
	 * @param string $name Name of the formatter.
	 * @param string $class A formatter class name.
	 */
	public function register( $name, $class ) {
		$this->formatters[ $name ] = new $class();
	}
}

Directory Contents

Dirs: 6 × Files: 9

Name Size Perms Modified Actions
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Payments DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Routes DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Schemas DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Utilities DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
13.86 KB lrw-r--r-- 2026-02-23 17:58:34
Edit Download
7.97 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download
1.21 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download
2.70 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download
3.09 KB lrw-r--r-- 2025-01-21 18:53:44
Edit Download
6.77 KB lrw-r--r-- 2025-11-24 23:10:10
Edit Download
3.34 KB lrw-r--r-- 2025-11-24 23:10:10
Edit Download
4.81 KB lrw-r--r-- 2026-03-30 17:12:24
Edit Download
3.52 KB lrw-r--r-- 2026-02-23 17:58:34
Edit Download

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