<?php
/**
* @author Gaetano Giunta
- * @copyright (C) 2006-2020 G. Giunta
+ * @copyright (C) 2006-2021 G. Giunta
* @license code licensed under the BSD License: see file license.txt
*/
* @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
{
* 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)
{
case 'true':
return Value::$xmlrpcBoolean;
case Value::$xmlrpcArray: // 'array':
+ case 'array[]';
return Value::$xmlrpcArray;
case 'object':
case Value::$xmlrpcStruct: // 'struct'
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