private static function Braintree_Xml_Generator::_generateXmlAttribute in Commerce Braintree 7
convert passed data into an array of attributeType, attributeName, and value dates sent as DateTime objects will be converted to strings @access protected
Parameters
mixed $value:
Return value
array attributes and element value
1 call to Braintree_Xml_Generator::_generateXmlAttribute()
- Braintree_Xml_Generator::_createElementsFromArray in braintree_php/
lib/ Braintree/ Xml/ Generator.php - Construct XML elements with attributes from an associative array.
File
- braintree_php/
lib/ Braintree/ Xml/ Generator.php, line 104
Class
- Braintree_Xml_Generator
- Generates XML output from arrays using PHP's built-in XMLWriter
Code
private static function _generateXmlAttribute($value) {
if ($value instanceof DateTime) {
return array(
'type',
'datetime',
self::_dateTimeToXmlTimestamp($value),
);
}
if (is_int($value)) {
return array(
'type',
'integer',
$value,
);
}
if (is_bool($value)) {
return array(
'type',
'boolean',
$value ? 'true' : 'false',
);
}
if ($value === NULL) {
return array(
'nil',
'true',
$value,
);
}
}