/**
  * Generates the parameters to use for the download request.
  *
  * @param mixed $reportDefinition the report definition, as an ID or object
  *
  * @return array the parameters
  */
 private static function GetParams($reportDefinition)
 {
     $params = array();
     if (is_numeric($reportDefinition)) {
         $params['__rd'] = $reportDefinition;
     } else {
         if (is_object($reportDefinition) || is_array($reportDefinition)) {
             $document = XmlUtils::ConvertObjectToDocument($reportDefinition, 'reportDefinition');
             $document->formatOutput = true;
             $params['__rdxml'] = XmlUtils::GetXmlFromDom($document);
         } else {
             throw new ReportDownloadException('Invalid report definition type: ' . $reportDefinition);
         }
     }
     return $params;
 }
 /**
  * A typemap conversion function for parsing long values in SOAP responses.
  *
  * @param string $xml the XML snippet containing the long value.
  *
  * @return mixed the inner long value as an integer, float, or string
  */
 public static function TypemapLongFromXml($xml)
 {
     $document = XmlUtils::GetDomFromXml($xml);
     $tag = $document->documentElement->localName;
     $value = $document->documentElement->nodeValue;
     $isIdField = preg_match('/^id$|Id$|ID$/', $tag);
     if (!$isIdField) {
         if (strcmp(strval(intval($value)), $value) === 0) {
             return intval($value);
         } elseif (strcmp(sprintf('%.0f', floatval($value)), $value) === 0) {
             return floatval($value);
         }
     }
     return $value;
 }