Automattic\WooCommerce\StoreApi

Formatters::__get()publicWC 1.0

Get a new instance of a formatter class.

Method of the class: Formatters{}

No Hooks.

Return

FormatterInterface. Formatter class instance.

Usage

$Formatters = new Formatters();
$Formatters->__get( $name );
$name(string) (required)
Name of the formatter.

Formatters::__get() code WC 8.6.1

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 ];
}