/
xmlrpcstruct.php
77 lines (70 loc) · 1.66 KB
/
xmlrpcstruct.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
namespace Habari;
/**
* @package Habari
*
*/
/**
* XMLRPC Struct type
* Used to hold struct types (objects) that are returned in XMLRPC requests.
*
*/
class XMLRPCStruct
{
private $fields = array();
/**
* Property setter for the XMLRPCStruct class.
* This allows the following:
* <code>
* $struct = new XMLRPCStruct();
* $struct->foo = 'bar'; // This is done by __set() and assigns 'bar' into $this->fields['foo']
* </code>
*
* @param string $name The name of the property on this object to set
* @param mixed $value The value to set in the property
* @return
*/
public function __set( $name, $value )
{
$this->fields[$name] = $value;
}
/**
* Property getter for the XMLRPCStruct class.
* Returns the value of $this->fields for the specified porperty name.
*
* @param string $name The name of the property
* @return mixed The value stored for the requested property
*/
public function __get( $name )
{
return $this->fields[$name];
}
/**
* Magic isset for XMLRPCStruct, returns whether a property value is set.
* @param string $name The name of the parameter
* @return boolean True if the value is set, false if not
*/
public function __isset( $name )
{
return isset( $this->fields[$name] );
}
/**
* Get the list of properties that this object contains.
*
* @return array List of object properties, as stored in $this->fields.
*/
public function get_fields()
{
return array_keys( $this->fields );
}
/**
* Constructor for XMLRPCStruct
*
* @param array $fields Default field values to set into properties.
*/
public function __construct( $fields = array() )
{
$this->fields = $fields;
}
}
?>