Scalr\Service\Aws\DataType\ListDataType::refresh PHP Method

refresh() protected method

Refreshes the list
protected refresh ( )
    protected function refresh()
    {
        $this->list = array();
        foreach ($this->aListData as $v) {
            if (is_string($v) || is_numeric($v)) {
                $this->list[] = $v;
            } else {
                if (is_array($v)) {
                    if ($this->propertyName === null) {
                        $this->list[] = $v;
                    } else {
                        if (is_array($this->propertyName)) {
                            $arr = array();
                            foreach ($this->propertyName as $sName) {
                                if (!array_key_exists($sName, $v)) {
                                    throw new \InvalidArgumentException(sprintf('Could not find %s index in array', $sName));
                                }
                                $arr[$sName] = $v[$sName];
                            }
                            $this->list[] = $arr;
                            unset($arr);
                        } else {
                            if (array_key_exists($this->propertyName, $v)) {
                                $this->list[] = $v[$this->propertyName];
                            } else {
                                throw new \InvalidArgumentException(sprintf('Could not find %s index in array', $this->propertyName));
                            }
                        }
                    }
                } else {
                    if (is_object($v)) {
                        if ($this->dataClassName !== null && !$v instanceof $this->dataClassName) {
                            throw new \InvalidArgumentException('Invalid List Data argument. It must be instance of ' . $this->dataClassName);
                        }
                        if ($this->propertyName === null) {
                            $this->list[] = $v;
                        } else {
                            if (is_array($this->propertyName)) {
                                $arr = array();
                                foreach ($this->propertyName as $sName) {
                                    if (property_exists($v, $sName)) {
                                        $arr[$sName] = $v->{$sName};
                                    } else {
                                        $method = 'get' . ucfirst($sName);
                                        $arr[$sName] = $v->{$method}();
                                    }
                                }
                                $this->list[] = $arr;
                                unset($arr);
                            } else {
                                if (property_exists($v, $this->propertyName)) {
                                    $this->list[] = $v->{$this->propertyName};
                                } else {
                                    $method = 'get' . ucfirst($this->propertyName);
                                    $this->list[] = $v->{$method}();
                                }
                            }
                        }
                    }
                }
            }
        }
    }