public static function values($data, $path = [], $base = null)
    {
        if (!$path) {
            $base = $base ?: 0;
            return [$base => $data];
        }

        $field = array_shift($path);

        if ($field === '*') {
            $values = [];
            foreach ($data as $key => $value) {
                $values = array_merge($values, static::values($value, $path, $base . '.' . $key));
            }
            return $values;
        } elseif (!isset($data[$field])) {
            return [];
        } elseif (!$path) {
            return [$base ? $base . '.' . $field : $field => $data[$field]];
        } else {
            return static::values($data[$field], $path, $base ? $base . '.' . $field : $field);
        }
    }
public static function values($data, $path = [], $base = null)
    {
        if (!$path) {
            $base = $base ?: 0;
            return [$base => $data];
        }

        $field = array_shift($path);

        if ($field === '*') {
            $values = [];
            foreach ($data as $key => $value) {
                $values = array_merge($values, static::values($value, $path, $base . '.' . $key));
            }
            return $values;
        } elseif (!isset($data[$field])) {
            return [];
        } elseif (!$path) {
            return [$base ? $base . '.' . $field : $field => $data[$field]];
        } else {
            return static::values($data[$field], $path, $base ? $base . '.' . $field : $field);
        }
    }
public static function values ( $ data , $ path = [ ] , $ base = null ) { if ( ! $ path ) { $ base = $ base ? : 0 ; return [ $ base => $ data ] ; } $ field = array_shift ( $ path ) ; if ( $ field === '*' ) { $ values = [ ] ; foreach ( $ data as $ key => $ value ) { $ values = array_merge ( $ values , static :: values ( $ value , $ path , $ base . '.' . $ key ) ) ; } return $ values ; } elseif ( ! isset ( $ data [ $ field ] ) ) { return [ ] ; } elseif ( ! $ path ) { return [ $ base ? $ base . '.' . $ field : $ field => $ data [ $ field ] ] ; } else { return static :: values ( $ data [ $ field ] , $ path , $ base ? $ base . '.' . $ field : $ field ) ; } }
Extracts all values corresponding to a field names path.

@param  array $data The data.
@param  array $path An array of field names.
@param  array $base The dotted fielname path of the data.
@return array       The extracted values.
Extracts all values corresponding to a field names path .