public static function unmarshalObject(\SimpleXMLElement $xml, $fallbackType = null) { $objectType = reset($xml->objectType); $type = Kaltura_Client_TypeMap::getZendType($objectType); if (!class_exists($type)) { $type = Kaltura_Client_TypeMap::getZendType($fallbackType); if (!class_exists($type)) { throw new Kaltura_Client_ClientException("Invalid object type class [{$type}] of Kaltura type [{$objectType}]", Kaltura_Client_ClientException::ERROR_INVALID_OBJECT_TYPE); } } return new $type($xml); }
public static function unmarshalItem(SimpleXMLElement $xml) { $nodeName = $xml->getName(); if (!$xml->objectType) { if ($xml->item) { return self::unmarshalArray($xml->children()); } if ($xml->error) { $code = "{$xml->error->code}"; $message = "{$xml->error->message}"; throw new Kaltura_Client_Exception($message, $code); } return "{$xml}"; } $objectType = reset($xml->objectType); $type = Kaltura_Client_TypeMap::getZendType($objectType); if (!class_exists($type)) { throw new Kaltura_Client_ClientException("Invalid object type class [{$type}] of Kaltura type [{$objectType}]", Kaltura_Client_ClientException::ERROR_INVALID_OBJECT_TYPE); } return new $type($xml); }
private function unmarshalItem(DOMElement $xml) { if (!$xml->objectType) { return $xml->textContent; } $type = Kaltura_Client_TypeMap::getZendType($xml->objectType); $ret = new $type(); }