function soap_parser::decodeSimple in Salesforce Suite 5.2
Same name in this branch
- 5.2 includes/nusoap.php \soap_parser::decodeSimple()
- 5.2 includes/nusoap.orig.php \soap_parser::decodeSimple()
Same name and namespace in other branches
- 5 includes/nusoap.php \soap_parser::decodeSimple()
- 5 includes/nusoap.orig.php \soap_parser::decodeSimple()
* decodes simple types into PHP variables * *
Parameters
string $value value to decode: * @param string $type XML type to decode * @param string $typens XML type namespace to decode * @return mixed PHP value * @access private
4 calls to soap_parser::decodeSimple()
- soap_parser::buildVal in includes/
nusoap.php - * builds response structures for compound values (arrays/structs) * and scalars * *
- soap_parser::buildVal in includes/
nusoap.orig.php - * builds response structures for compound values (arrays/structs) * and scalars * *
- soap_parser::end_element in includes/
nusoap.php - * end-element handler * *
- soap_parser::end_element in includes/
nusoap.orig.php - * end-element handler * *
File
- includes/
nusoap.php, line 6267
Class
- soap_parser
- soap_parser class parses SOAP XML messages into native PHP values
Code
function decodeSimple($value, $type, $typens) {
// TODO: use the namespace!
if (!isset($type) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
return (string) $value;
}
if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
return (int) $value;
}
if ($type == 'float' || $type == 'double' || $type == 'decimal') {
return (double) $value;
}
if ($type == 'boolean') {
if (strtolower($value) == 'false' || strtolower($value) == 'f') {
return false;
}
return (bool) $value;
}
if ($type == 'base64' || $type == 'base64Binary') {
$this
->debug('Decode base64 value');
return base64_decode($value);
}
// obscure numeric types
if ($type == 'nonPositiveInteger' || $type == 'negativeInteger' || $type == 'nonNegativeInteger' || $type == 'positiveInteger' || $type == 'unsignedInt' || $type == 'unsignedShort' || $type == 'unsignedByte') {
return (int) $value;
}
// bogus: parser treats array with no elements as a simple type
if ($type == 'array') {
return array();
}
// everything else
return (string) $value;
}