option_group ( $data, $member, $key, $out )

A protected method that is used by json(), yaml() and map().

Access

public static

Parameters

Parameter

Type

Required

Description

$data

string
array

Required

The data to iterate over.

$member

string

Optional

The name of the “member” property that AWS uses for lists in certain services. Defaults to an empty string.

$key

string

Optional

The default key to use when the value for $data is a string. Defaults to an empty string.

$out

array

Optional

INTERNAL ONLY. The array that contains the calculated values up to this point.

Returns

Type

Description

array

The option group parameters to merge into another method’s $opt parameter.

Source

Method defined in utilities/complextype.class.php | Toggle source view (44 lines) | View on GitHub

public static function option_group($data, $member = '', $key = '', &$out = array())
{
    $reset = $key;

    if (is_array($data))
    {
        foreach ($data as $k => $v)
        {
            // Avoid 0-based indexes.
            if (is_int($k))
            {
                $k = $k + 1;

                if ($member !== '')
                {
                    $key .= '.' . $member;
                }
            }

            $key .= ($key === '' ? $k : '.' . $k);

            if (is_array($v))
            {
                self::option_group($v, $member, $key, $out);
            }
            elseif ($v instanceof CFStepConfig)
            {
                self::option_group($v->get_config(), $member, $key, $out);
            }
            else
            {
                $out[$key] = $v;
            }

            $key = $reset;
        }
    }
    else
    {
        $out[$key] = $data;
    }

    return $out;
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback