Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers
DotNotation::get()
Find the given $path in $array by dot notation.
Method of the class: DotNotation{}
No Hooks.
Return
Mixed|null
.
Usage
$DotNotation = new DotNotation(); $DotNotation->get( $array, $path, $default );
- $array(array) (required)
- an array to search in.
- $path(string) (required)
- a path in the given array.
- $default(null)
- default value to return if $path was not found.
Default: null
DotNotation::get() DotNotation::get code WC 8.7.0
public function get( $array, $path, $default = null ) { if ( ! is_array( $array ) ) { return $default; } if ( isset( $array[ $path ] ) ) { return $array[ $path ]; } foreach ( explode( '.', $path ) as $segment ) { if ( ! is_array( $array ) || ! array_key_exists( $segment, $array ) ) { return $default; } $array = $array[ $segment ]; } return $array; }