X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2FWrapper.php;h=bf624e46adc980f30b0f277f3fce15261097ed20;hb=a8f93d5ce43365c83361071a847cb977f3ede519;hp=a3572ae399ec2f7abfdbab9eb28eec73f000f926;hpb=57812a66f7e807af1c37d4e79913776b52dfd2c3;p=plcapi.git diff --git a/src/Wrapper.php b/src/Wrapper.php index a3572ae3..bf624e46 100644 --- a/src/Wrapper.php +++ b/src/Wrapper.php @@ -16,6 +16,7 @@ use PhpXmlRpc\Helper\Logger; * @todo use some better templating system for code generation? * @todo implement method wrapping with preservation of php objs in calls * @todo when wrapping methods without obj rebuilding, use return_type = 'phpvals' (faster) + * @todo add support for 'epivals' mode */ class Wrapper { @@ -28,12 +29,14 @@ class Wrapper * Notes: * - for php 'resource' types returns empty string, since resources cannot be serialized; * - for php class names returns 'struct', since php objects can be serialized as xmlrpc structs - * - for php arrays always return array, even though arrays sometimes serialize as json structs + * - for php arrays always return array, even though arrays sometimes serialize as structs... * - for 'void' and 'null' returns 'undefined' * * @param string $phpType * * @return string + * + * @todo support notation `something[]` as 'array' */ public function php2XmlrpcType($phpType) { @@ -53,6 +56,7 @@ class Wrapper case 'true': return Value::$xmlrpcBoolean; case Value::$xmlrpcArray: // 'array': + case 'array[]'; return Value::$xmlrpcArray; case 'object': case Value::$xmlrpcStruct: // 'struct' @@ -63,6 +67,9 @@ class Wrapper return ''; default: if (class_exists($phpType)) { + if (is_a($phpType, 'DateTimeInterface')) { + return Value::$xmlrpcDateTime; + } return Value::$xmlrpcStruct; } else { // unknown: might be any 'extended' xmlrpc type