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, bool $is_default_set, string $default_value) : mixed|null
Parameters
$target_value : mixed

a value to transform.

$transformer_configs : array<string|int, mixed>

transform configuration.

$is_default_set : bool

flag on is default value set.

$default_value : string

default value.

Tags
throws
InvalidArgumentException

Throws when one of the requried arguments is missing.

Return values
mixed|null