/** * Create an associative array of object properties from XML * @static * @param SimpleXMLElement $parsedResponse - XML of registrant * @return */ public static function createStruct($parsedResponse) { $reg['title'] = (string) $parsedResponse->title; $reg['updated'] = (string) $parsedResponse->updated; $reg['link'] = (string) $parsedResponse->link->Attributes()->href; $reg['id'] = (string) $parsedResponse->id; $content = $parsedResponse->content->children(); $reg['lastName'] = (string) $content->Registrant->LastName; $reg['firstName'] = (string) $content->Registrant->FirstName; $reg['email'] = (string) $content->Registrant->EmailAddress; $reg['registrationStatus'] = (string) $content->Registrant->RegistrationStatus; $reg['registrationDate'] = (string) $content->Registrant->RegistrationDate; $reg['guestCount'] = (string) $content->Registrant->GuestCount; $reg['paymentStatus'] = (string) $content->Registrant->PaymentStatus; $reg['personalInformation'] = new PersonalInformation(PersonalInformation::createStruct($content->Registrant->PersonalInformation)); $reg['businessInformation'] = new BusinessInformation(BusinessInformation::createStruct($content->Registrant->BusinessInformation)); $reg['customInformation1'] = array(); $reg['customInformation2'] = array(); $reg['costs'] = array(); if (isset($content->Registrant->CustomInformation1->CustomField)) { foreach ($content->Registrant->CustomInformation1->CustomField as $customInfo) { $reg['customInformation1'][] = CustomField::createFromXml($customInfo); } } if (isset($content->Registrant->CustomInformation2->CustomField)) { foreach ($content->Registrant->CustomInformation2->CustomField as $customInfo) { $reg['customInformation2'][] = CustomField::createFromXml($customInfo); } } if (isset($content->Registrant->Costs->Cost)) { foreach ($content->Registrant->Costs->Cost as $cost) { $reg['costs'] = new Cost(Cost::createStruct($cost)); } } return $reg; }