public static function unmarshalObject(\SimpleXMLElement $xml, $fallbackType = null)
 {
     $objectType = reset($xml->objectType);
     $type = TypeMap::getZendType($objectType);
     if (!class_exists($type)) {
         $type = TypeMap::getZendType($fallbackType);
         if (!class_exists($type)) {
             throw new ClientException("Invalid object type class [{$type}] of Kaltura type [{$objectType}]", 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}";
             return new ApiException($message, $code);
         }
         return "{$xml}";
     }
     $objectType = reset($xml->objectType);
     $type = TypeMap::getZendType($objectType);
     if (!class_exists($type)) {
         throw new ClientException("Invalid object type class [{$type}] of Kaltura type [{$objectType}]", ClientException::ERROR_INVALID_OBJECT_TYPE);
     }
     return new $type($xml);
 }