Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers

ArraySearch::transform()publicWC 1.0

Search a given value in the array.

Метод класса: ArraySearch{}

No Hooks.

Return

Mixed|null.

Usage

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

Code of ArraySearch::transform() WC 7.1.0

public function transform( $value, stdClass $arguments = null, $default = null ) {
	$key = array_search( $arguments->value, $value, true );
	if ( false !== $key ) {
		return $value[ $key ];
	}

	return null;
}