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(); } }