1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Defines functions and signatures which can be registered as methods exposed by an XML-RPC Server. |
4
|
|
|
* |
5
|
|
|
* To use this, use something akin to: |
6
|
|
|
* $signatures = include('interop.php'); |
7
|
|
|
* |
8
|
|
|
* Trivial interop tests |
9
|
|
|
* http://www.xmlrpc.com/stories/storyReader$1636 |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
use PhpXmlRpc\Response; |
13
|
|
|
use PhpXmlRpc\Value; |
14
|
|
|
|
15
|
559 |
|
$i_echoString_sig = array(array(Value::$xmlrpcString, Value::$xmlrpcString)); |
16
|
559 |
|
$i_echoString_doc = "Echoes string."; |
17
|
|
|
|
18
|
559 |
|
$i_echoStringArray_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray)); |
19
|
559 |
|
$i_echoStringArray_doc = "Echoes string array."; |
20
|
|
|
|
21
|
559 |
|
$i_echoInteger_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcInt)); |
22
|
559 |
|
$i_echoInteger_doc = "Echoes integer."; |
23
|
|
|
|
24
|
559 |
|
$i_echoIntegerArray_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray)); |
25
|
559 |
|
$i_echoIntegerArray_doc = "Echoes integer array."; |
26
|
|
|
|
27
|
559 |
|
$i_echoFloat_sig = array(array(Value::$xmlrpcDouble, Value::$xmlrpcDouble)); |
28
|
559 |
|
$i_echoFloat_doc = "Echoes float."; |
29
|
|
|
|
30
|
559 |
|
$i_echoFloatArray_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray)); |
31
|
559 |
|
$i_echoFloatArray_doc = "Echoes float array."; |
32
|
|
|
|
33
|
559 |
|
$i_echoStruct_sig = array(array(Value::$xmlrpcStruct, Value::$xmlrpcStruct)); |
34
|
559 |
|
$i_echoStruct_doc = "Echoes struct."; |
35
|
|
|
|
36
|
559 |
|
$i_echoStructArray_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray)); |
37
|
559 |
|
$i_echoStructArray_doc = "Echoes struct array."; |
38
|
|
|
|
39
|
559 |
|
$i_echoValue_doc = "Echoes any value back."; |
40
|
559 |
|
$i_echoValue_sig = array(array(Value::$xmlrpcValue, Value::$xmlrpcValue)); |
41
|
|
|
|
42
|
559 |
|
$i_echoBase64_sig = array(array(Value::$xmlrpcBase64, Value::$xmlrpcBase64)); |
43
|
559 |
|
$i_echoBase64_doc = "Echoes base64."; |
44
|
|
|
|
45
|
559 |
|
$i_echoDate_sig = array(array(Value::$xmlrpcDateTime, Value::$xmlrpcDateTime)); |
46
|
559 |
|
$i_echoDate_doc = "Echoes dateTime."; |
47
|
|
|
|
48
|
|
|
$i_whichToolkit_sig = array(array(Value::$xmlrpcStruct)); |
49
|
|
|
$i_whichToolkit_doc = "Returns a struct containing the following strings: toolkitDocsUrl, toolkitName, toolkitVersion, toolkitOperatingSystem."; |
50
|
|
|
|
51
|
|
|
function i_echoParam($req) |
52
|
|
|
{ |
53
|
|
|
$v = $req->getParam(0); |
54
|
|
|
|
55
|
|
|
return new Response($v); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
function i_whichToolkit($req) |
|
|
|
|
59
|
|
|
{ |
60
|
|
|
$ret = array( |
61
|
|
|
"toolkitDocsUrl" => "https://gggeek.github.io/phpxmlrpc/", |
62
|
|
|
"toolkitName" => PhpXmlRpc\PhpXmlRpc::$xmlrpcName, |
63
|
|
|
"toolkitVersion" => PhpXmlRpc\PhpXmlRpc::$xmlrpcVersion, |
64
|
|
|
"toolkitOperatingSystem" => $_SERVER['SERVER_SOFTWARE'], |
65
|
|
|
); |
66
|
|
|
|
67
|
|
|
$encoder = new PhpXmlRpc\Encoder(); |
68
|
|
|
return new Response($encoder->encode($ret)); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
return array( |
72
|
|
|
"interopEchoTests.echoString" => array( |
73
|
|
|
"function" => "i_echoParam", |
74
|
|
|
"signature" => $i_echoString_sig, |
75
|
|
|
"docstring" => $i_echoString_doc, |
76
|
|
|
), |
77
|
|
|
"interopEchoTests.echoStringArray" => array( |
78
|
|
|
"function" => "i_echoParam", |
79
|
|
|
"signature" => $i_echoStringArray_sig, |
80
|
|
|
"docstring" => $i_echoStringArray_doc, |
81
|
|
|
), |
82
|
|
|
"interopEchoTests.echoInteger" => array( |
83
|
|
|
"function" => "i_echoParam", |
84
|
|
|
"signature" => $i_echoInteger_sig, |
85
|
|
|
"docstring" => $i_echoInteger_doc, |
86
|
|
|
), |
87
|
|
|
"interopEchoTests.echoIntegerArray" => array( |
88
|
|
|
"function" => "i_echoParam", |
89
|
|
|
"signature" => $i_echoIntegerArray_sig, |
90
|
|
|
"docstring" => $i_echoIntegerArray_doc, |
91
|
|
|
), |
92
|
|
|
"interopEchoTests.echoFloat" => array( |
93
|
|
|
"function" => "i_echoParam", |
94
|
|
|
"signature" => $i_echoFloat_sig, |
95
|
|
|
"docstring" => $i_echoFloat_doc, |
96
|
|
|
), |
97
|
|
|
"interopEchoTests.echoFloatArray" => array( |
98
|
|
|
"function" => "i_echoParam", |
99
|
|
|
"signature" => $i_echoFloatArray_sig, |
100
|
|
|
"docstring" => $i_echoFloatArray_doc, |
101
|
|
|
), |
102
|
|
|
"interopEchoTests.echoStruct" => array( |
103
|
|
|
"function" => "i_echoParam", |
104
|
|
|
"signature" => $i_echoStruct_sig, |
105
|
|
|
"docstring" => $i_echoStruct_doc, |
106
|
|
|
), |
107
|
|
|
"interopEchoTests.echoStructArray" => array( |
108
|
|
|
"function" => "i_echoParam", |
109
|
|
|
"signature" => $i_echoStructArray_sig, |
110
|
559 |
|
"docstring" => $i_echoStructArray_doc, |
111
|
559 |
|
), |
112
|
|
|
"interopEchoTests.echoValue" => array( |
113
|
|
|
"function" => "i_echoParam", |
114
|
|
|
"signature" => $i_echoValue_sig, |
115
|
|
|
"docstring" => $i_echoValue_doc, |
116
|
|
|
), |
117
|
|
|
"interopEchoTests.echoBase64" => array( |
118
|
|
|
"function" => "i_echoParam", |
119
|
|
|
"signature" => $i_echoBase64_sig, |
120
|
|
|
"docstring" => $i_echoBase64_doc, |
121
|
|
|
), |
122
|
|
|
"interopEchoTests.echoDate" => array( |
123
|
|
|
"function" => "i_echoParam", |
124
|
|
|
"signature" => $i_echoDate_sig, |
125
|
|
|
"docstring" => $i_echoDate_doc, |
126
|
|
|
), |
127
|
|
|
"interopEchoTests.whichToolkit" => array( |
128
|
|
|
"function" => "i_whichToolkit", |
129
|
559 |
|
"signature" => $i_whichToolkit_sig, |
130
|
559 |
|
"docstring" => $i_whichToolkit_doc, |
131
|
559 |
|
), |
132
|
|
|
); |
133
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.