Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers
DotNotation::get()
Find the given $path in $array by dot notation.
Метод класса: DotNotation{}
Хуков нет.
Возвращает
Разное|null
.
Использование
$DotNotation = new DotNotation(); $DotNotation->get( $array, $path, $default );
- $array(массив) (обязательный)
- an array to search in.
- $path(строка) (обязательный)
- a path in the given array.
- $default(null)
- default value to return if $path was not found.
По умолчанию: null
Код DotNotation::get() DotNotation::get 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; }