WooCommerce Code Reference

DotNotation implements TransformerInterface

Find an array value by dot notation.

Interfaces, Classes and Traits

TransformerInterface
An interface to define a transformer.

Table of Contents

get()  : mixed|null
Find the given $path in $array_to_search by dot notation.
transform()  : mixed
Find given path from the given value.
validate()  : mixed
Validate Transformer arguments.

Methods

get()

Find the given $path in $array_to_search by dot notation.

public get(array<string|int, mixed> $array_to_search, string $path[, null $default_value = null ]) : mixed|null
Parameters
$array_to_search : array<string|int, mixed>

an array to search in.

$path : string

a path in the given array.

$default_value : null = null

default value to return if $path was not found.

Return values
mixed|null

transform()

Find given path from the given value.

public transform(mixed $value[, stdClass|null $arguments = null ][, string|null $default_value = null ]) : mixed
Parameters
$value : mixed

a value to transform.

$arguments : stdClass|null = null

required argument 'path'.

$default_value : string|null = null

default value.

Tags
throws
InvalidArgumentException

Throws when the required 'path' is missing.

Return values
mixed