Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers
ArraySearch::transform()
Search a given value in the array.
Method of the class: 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
ArraySearch::transform() ArraySearch::transform code WC 8.7.0
public function transform( $value, stdClass $arguments = null, $default = null ) { if ( ! is_array( $value ) ) { return $default; } $key = array_search( $arguments->value, $value, true ); if ( false !== $key ) { return $value[ $key ]; } return null; }