/** * <MethodDescription> * * @param type <description> * * @return type <description> */ function Studip_Ws_Method(&$service, $name, $expects = NULL, $returns = NULL, $description = '') { # check $expects if (is_null($expects)) { $expects = array(); } else { if (!is_array($expects)) { trigger_error('Third argument is expected to be an array.', E_USER_ERROR); return; } } $this->service =& $service; $this->name = $name; $this->description = (string) $description; $this->expects = $expects; $this->returns = $returns; foreach ($this->expects as $key => $entry) { $this->expects[$key] = Studip_Ws_Type::translate($entry); } $this->returns = Studip_Ws_Type::translate($this->returns); }
/** * <MethodDescription> * * @param mixed <description> * * @return void */ function store_type_recursive(&$type) { $type_class = Studip_Ws_Type::get_type($type); if ($type_class === STUDIP_WS_TYPE_ARRAY) { $element_type =& Studip_Ws_Type::get_element_type($type); $this->store_type($element_type); $this->store_type_recursive($element_type); } else { if ($type_class === STUDIP_WS_TYPE_STRUCT) { $struct =& Studip_Ws_Type::get_element_type($type); foreach (Studip_Ws_Type::get_struct_elements($struct) as $element) { if ($this->store_type($element->type)) { $this->store_type_recursive($element->type); } } } } }
/** * <MethodDescription> * * @param type <description> * * @return type <description> */ function is_primitive_type($type) { return !Studip_Ws_Type::is_complex_type($type); }
/** * Constructor. * * @param string the name of the element. * @param mixed the type of the element. * @param array options for the element. * * @return void */ function Studip_Ws_StructElement($name, $type, $options = array()) { $this->name = (string) $name; $this->type = Studip_Ws_Type::translate($type); $this->options = $options; }
/** * <MethodDescription> * * @param type <description> * * @return type <description> */ function translate_type($type0) { switch ($type = Studip_Ws_Type::get_type($type0)) { case STUDIP_WS_TYPE_INT: return $GLOBALS['xmlrpcInt']; case STUDIP_WS_TYPE_STRING: return $GLOBALS['xmlrpcString']; case STUDIP_WS_TYPE_BASE64: return $GLOBALS['xmlrpcBase64']; case STUDIP_WS_TYPE_BOOL: return $GLOBALS['xmlrpcBoolean']; case STUDIP_WS_TYPE_FLOAT: return $GLOBALS['xmlrpcDouble']; case STUDIP_WS_TYPE_NULL: return $GLOBALS['xmlrpcBoolean']; case STUDIP_WS_TYPE_ARRAY: return $GLOBALS['xmlrpcArray']; case STUDIP_WS_TYPE_STRUCT: return $GLOBALS['xmlrpcStruct']; } trigger_error(sprintf('Type %s could not be found.', var_export($type, TRUE)), E_USER_ERROR); return $GLOBALS['xmlrpcString']; }