XmlSerializer::CreateChildListForObjects PHP Method

CreateChildListForObjects() private method

Creates an array of child elements for objects.
private CreateChildListForObjects ( object $object, DOMDocument $document, boolean $useXsiType ) : array
$object object the object whose properties will be serialized
$document DOMDocument the document being constructed
$useXsiType boolean whether the xsi:type will be added into XML tags when available
return array an array of child elements created from the specified object
    private function CreateChildListForObjects($object, DOMDocument $document, $useXsiType)
    {
        $children = array();
        foreach (get_object_vars($object) as $field => $value) {
            if (is_array($value) && !MapUtils::IsMap($value)) {
                foreach ($value as $item) {
                    $children[] = self::ConvertObjectToElement($item, $field, $document, $useXsiType);
                }
            } else {
                $children[] = self::ConvertObjectToElement($value, $field, $document, $useXsiType);
            }
        }
        return $children;
    }