Automattic\WooCommerce\Internal\Admin\ProductForm

Component::get_argument_from_path()public staticWC 1.0

Gets argument by dot notation path.

Method of the class: Component{}

No Hooks.

Return

Mixed|null.

Usage

$result = Component::get_argument_from_path( $arguments, $path, $delimiter );
$arguments(array) (required)
Arguments array.
$path(string) (required)
Path for argument key.
$delimiter(string)
Path delimiter, default: '.'.
Default: '.'

Component::get_argument_from_path() code WC 9.0.1

public static function get_argument_from_path( $arguments, $path, $delimiter = '.' ) {
	$path_keys = explode( $delimiter, $path );
	$num_keys  = false !== $path_keys ? count( $path_keys ) : 0;

	$val = $arguments;
	for ( $i = 0; $i < $num_keys; $i++ ) {
		$key = $path_keys[ $i ];
		if ( array_key_exists( $key, $val ) ) {
			$val = $val[ $key ];
		} else {
			$val = null;
			break;
		}
	}
	return $val;
}