Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers

ArrayFlatten::transform()publicWC 1.0

Search a given value in the array.

Method of the class: ArrayFlatten{}

No Hooks.

Return

Mixed|null.

Usage

$ArrayFlatten = new ArrayFlatten();
$ArrayFlatten->transform( $value, $arguments, $default );
$value(mixed) (required)
a value to transform.
$arguments(stdClass|null)
arguments.
Default: null
$default(string|null)
default value.
Default: array()

ArrayFlatten::transform() code WC 8.7.0

public function transform( $value, stdClass $arguments = null, $default = array() ) {
	if ( ! is_array( $value ) ) {
		return $default;
	}

	$return = array();
	array_walk_recursive(
		$value,
		function( $item ) use ( &$return ) {
			$return[] = $item;
		}
	);

	return $return;
}