WooCommerce Code Reference

TransformerService

A simple service class for the Transformer classes.

Class TransformerService

Table of Contents

apply()  : mixed|null
Apply transformers to the given value.
create_transformer()  : TransformerInterface|null
Create a transformer object by name.

Methods

apply()

Apply transformers to the given value.

public static apply(mixed $target_value, array<string|int, mixed> $transformer_configs, string $default) : mixed|null
Parameters
$target_value : mixed

a value to transform.

$transformer_configs : array<string|int, mixed>

transform configuration.

$default : string

default value.

Tags
throws
InvalidArgumentException

Throws when one of the requried arguments is missing.

Return values
mixed|null