XRL
2.0.0
Simple XML-RPC Library (both client and server)
|
A simple XML-RPC server. More...
Public Member Functions | |
__construct (\fpoirotte\XRL\EncoderInterface $encoder=null,\fpoirotte\XRL\DecoderInterface $decoder=null) | |
__get ($func) | |
__isset ($func) | |
__set ($func, $callback) | |
__unset ($func) | |
call ($procedure, array $params) | |
count () | |
expose ($other, $prefix= '') | |
getIterator () | |
handle ($URI=null) | |
offsetExists ($func) | |
offsetGet ($func) | |
offsetSet ($func, $callback) | |
offsetUnset ($func) | |
Protected Attributes | |
$XRLDecoder | |
Decoder for the response. | |
$XRLEncoder | |
Encoder for the request. | |
$XRLFunctions | |
Registered "procedures". | |
A simple XML-RPC server.
This class uses dynamic properties to manager XML-RPC procedures:
You may also count how many XML-RPC procedures are currently registered on this server:
Last but not least, you may also iterate over this server's registered XML-RPC procedures:
Definition at line 67 of file Server.php.
fpoirotte\XRL\Server::__construct | ( | \fpoirotte\XRL\EncoderInterface | $encoder = null , |
\fpoirotte\XRL\DecoderInterface | $decoder = null |
||
) |
Create a new XML-RPC server.
fpoirotte::XRL::EncoderInterface | $encoder | (optional) Encoder to use to build responses. If omitted, an encoder that accepts native PHP types, does not use indentation, but uses the <string> tags is automatically created using the machine's timezone. |
fpoirotte::XRL::DecoderInterface | $decoder | (optional) Decoder to use to parse responses. If omitted, a decoder that performs XML validation and converts values to native PHP types is automatically created using the machine's timezone. |
InvalidArgumentException | The given timezone is invalid. |
Definition at line 97 of file Server.php.
fpoirotte\XRL\Server::__get | ( | $func | ) |
Return a procedure previously registered with this XML-RPC server.
string | $func | The name of the registered XML-RPC procedure to return. |
mixed | The callable responsible for the XML-RPC procedure registered with the given name, as an object implementing the fpoirotte::XRL::CallableInterface interface, or null if the given name does not refer to an XML-RPC procedure known to this server. |
Definition at line 174 of file Server.php.
fpoirotte\XRL\Server::__isset | ( | $func | ) |
Test whether a procedure has been registered with the given name on this server.
string | $func | Name of the procedure whose existence must be verified. |
bool | true if the procedure exists, false otherwise. |
Definition at line 201 of file Server.php.
fpoirotte\XRL\Server::__set | ( | $func, | |
$callback | |||
) |
Register a new procedure with this XML-RPC server.
string | $func | A valid name for the procedure. Names starting with the string "XRL" (case-insensitive) are reserved. |
mixed | $callback | Any valid PHP callback. |
Definition at line 139 of file Server.php.
fpoirotte\XRL\Server::__unset | ( | $func | ) |
Unregister a procedure.
string | $func | The name of the procedure to unregister. |
Definition at line 227 of file Server.php.
fpoirotte\XRL\Server::call | ( | $procedure, | |
array | $params | ||
) |
Call an XML-RPC procedure.
string | $procedure | Name of the procedure to call. |
array | $params | Parameters for that procedure. |
mixed | The procedure's return value. |
Definition at line 387 of file Server.php.
References fpoirotte\XRL\Faults\METHOD_NOT_FOUND.
Referenced by fpoirotte\XRL\Server\handle().
fpoirotte\XRL\Server::count | ( | ) |
Return the number of XML-RPC procedures currently registered on this server.
int | Number of currently registered procedures on this server. |
Implements Countable.
Definition at line 250 of file Server.php.
fpoirotte\XRL\Server::expose | ( | $other, | |
$prefix = '' |
|||
) |
Expose the public methods of a class or object, with an optional prefix.
mixed | $other | Class or object to expose. For classes, only public static methods are exposed. For objects, public non-static methods are exposed, except for the constructor. |
string | $prefix | Prefix under which the class/object's methods will be exposed. Defaults to the empty string (ie. the methods are exposed without any prefix). |
get_class($object)
Definition at line 292 of file Server.php.
fpoirotte\XRL\Server::getIterator | ( | ) |
Get an iterator over this server's registered XML-RPC procedures.
ArrayIterator | An iterator over this server's registered procedures. |
Implements IteratorAggregate.
Definition at line 263 of file Server.php.
fpoirotte\XRL\Server::handle | ( | $URI = null | ) |
Handle an XML-RPC request and return a response for it.
string | $URI | (optional) URI to the XML-RPC request to process, If omitted, this method will try to retrieve the request directly from the data POST'ed to this script. |
fpoirotte::XRL::ResponseInterface | The response for that request. This response may indicate either success or failure of the Remote Procedure Call. |
Definition at line 354 of file Server.php.
References fpoirotte\XRL\Server\call().
fpoirotte\XRL\Server::offsetExists | ( | $func | ) |
Test whether a procedure has been registered with the given name on this server.
string | $func | Name of the procedure whose existence must be verified. |
bool | true if the procedure exists, false otherwise. |
This method is an alias for fpoirotte::XRL::Server::__isset().
Implements ArrayAccess.
Definition at line 211 of file Server.php.
fpoirotte\XRL\Server::offsetGet | ( | $func | ) |
Return a procedure previously registered with this XML-RPC server.
string | $func | The name of the registered XML-RPC procedure to return. |
mixed | The callable responsible for the XML-RPC procedure registered with the given name, as an object implementing the fpoirotte::XRL::CallableInterface interface, or null if the given name does not refer to an XML-RPC procedure known to this server. |
This method is an alias for fpoirotte::XRL::Server::__get().
Implements ArrayAccess.
Definition at line 184 of file Server.php.
fpoirotte\XRL\Server::offsetSet | ( | $func, | |
$callback | |||
) |
Register a new procedure with this XML-RPC server.
string | $func | A valid name for the procedure. Names starting with the string "XRL" (case-insensitive) are reserved. |
mixed | $callback | Any valid PHP callback. |
This method is an alias for fpoirotte::XRL::Server::__set().
Implements ArrayAccess.
Definition at line 149 of file Server.php.
fpoirotte\XRL\Server::offsetUnset | ( | $func | ) |
Unregister a procedure.
string | $func | The name of the procedure to unregister. |
This method is an alias for fpoirotte::XRL::Server::__unset().
Implements ArrayAccess.
Definition at line 237 of file Server.php.