1<?php
2
3
4
5
6/**
7* For creating serializable abstractions of native PHP types.  This class
8* allows element name/namespace, XSD type, and XML attributes to be
9* associated with a value.  This is extremely useful when WSDL is not
10* used, but is also useful when WSDL is used with polymorphic types, including
11* xsd:anyType and user-defined types.
12*
13* @author   Dietrich Ayala <dietrich@ganx4.com>
14* @access   public
15*/
16class soapval extends nusoap_base {
17	/**
18	 * The XML element name
19	 *
20	 * @var string
21	 * @access private
22	 */
23	var $name;
24	/**
25	 * The XML type name (string or false)
26	 *
27	 * @var mixed
28	 * @access private
29	 */
30	var $type;
31	/**
32	 * The PHP value
33	 *
34	 * @var mixed
35	 * @access private
36	 */
37	var $value;
38	/**
39	 * The XML element namespace (string or false)
40	 *
41	 * @var mixed
42	 * @access private
43	 */
44	var $element_ns;
45	/**
46	 * The XML type namespace (string or false)
47	 *
48	 * @var mixed
49	 * @access private
50	 */
51	var $type_ns;
52	/**
53	 * The XML element attributes (array or false)
54	 *
55	 * @var mixed
56	 * @access private
57	 */
58	var $attributes;
59
60	/**
61	* constructor
62	*
63	* @param    string $name optional name
64	* @param    mixed $type optional type name
65	* @param	mixed $value optional value
66	* @param	mixed $element_ns optional namespace of value
67	* @param	mixed $type_ns optional namespace of type
68	* @param	mixed $attributes associative array of attributes to add to element serialization
69	* @access   public
70	*/
71	function __construct($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
72		parent::__construct();
73		$this->name = $name;
74		$this->type = $type;
75		$this->value = $value;
76		$this->element_ns = $element_ns;
77		$this->type_ns = $type_ns;
78		$this->attributes = $attributes;
79    }
80
81	/**
82	* return serialized value
83	*
84	* @param	string $use The WSDL use value (encoded|literal)
85	* @return	string XML data
86	* @access   public
87	*/
88	function serialize($use='encoded') {
89		return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true);
90    }
91
92	/**
93	* decodes a soapval object into a PHP native type
94	*
95	* @return	mixed
96	* @access   public
97	*/
98	function decode(){
99		return $this->value;
100	}
101}
102
103
104
105
106?>