Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors\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, ?stdClass $arguments, $default_value );
- $value(mixed) (required)
- a value to transform.
- ?stdClass $arguments **
- -
Default: null - $default_value(string|null)
- default value.
Default: null
ArraySearch::transform() ArraySearch::transform code WC 9.7.1
public function transform( $value, ?stdClass $arguments = null, $default_value = null ) { if ( ! is_array( $value ) ) { return $default_value; } $key = array_search( $arguments->value, $value, true ); if ( false !== $key ) { return $value[ $key ]; } return null; }