src/mako/utility/Arr.php
public static function expandKey(array $array, string $key): array
	{
		if(strpos($key, '*') === false)
		{
			throw new RuntimeException('The key must contain at least one wildcard character.');
		}

		$keys = (array) $key;

		start:

		$expanded = [];

		foreach($keys as $key)
		{
			[$first, $remaining] = array_map('trim', explode('*', $key, 2), ['.', '.']);

			if(empty($first))
			{
				$value = $array;
			}
			elseif(is_array($value = static::get($array, $first)) === false)
			{
				continue;
			}

			foreach(array_keys($value) as $key)
			{
				$expanded[] = trim($first . '.' . $key . '.' . $remaining, '.');
			}
		}

		if(strpos($remaining, '*') !== false)
		{
			$keys = $expanded;

			goto start;
		}

		return $expanded;
	}
public static function expandKey(array $array, string $key): array
	{
		if(strpos($key, '*') === false)
		{
			throw new RuntimeException('The key must contain at least one wildcard character.');
		}

		$keys = (array) $key;

		start:

		$expanded = [];

		foreach($keys as $key)
		{
			[$first, $remaining] = array_map('trim', explode('*', $key, 2), ['.', '.']);

			if(empty($first))
			{
				$value = $array;
			}
			elseif(is_array($value = static::get($array, $first)) === false)
			{
				continue;
			}

			foreach(array_keys($value) as $key)
			{
				$expanded[] = trim($first . '.' . $key . '.' . $remaining, '.');
			}
		}

		if(strpos($remaining, '*') !== false)
		{
			$keys = $expanded;

			goto start;
		}

		return $expanded;
	}
public static function expandKey ( array $ array , string $ key ) : array { if ( strpos ( $ key , '*' ) === false ) { throw new RuntimeException ( 'The key must contain at least one wildcard character.' ) ; } $ keys = ( array ) $ key ; start : $ expanded = [ ] ; foreach ( $ keys as $ key ) { [ $ first , $ remaining ] = array_map ( 'trim' , explode ( '*' , $ key , 2 ) , [ '.' , '.' ] ) ; if ( empty ( $ first ) ) { $ value = $ array ; } elseif ( is_array ( $ value = static :: get ( $ array , $ first ) ) === false ) { continue ; } foreach ( array_keys ( $ value ) as $ key ) { $ expanded [ ] = trim ( $ first . '.' . $ key . '.' . $ remaining , '.' ) ; } } if ( strpos ( $ remaining , '*' ) !== false ) { $ keys = $ expanded ; goto start ; } return $ expanded ; }
Expands a wildcard key to an array of "dot notation" keys.

@param  array             $array Array
@param  string            $key   Wildcard key
@throws \RuntimeException
@return array
Expands a wildcard key to an array of dot notation keys .