|
XRL
3.1.1
Simple XML-RPC Library (both client and server)
|
A decoder that can process XML-RPC requests and responses, with optional XML validation. More...
Inheritance diagram for fpoirotte\XRL\Decoder:Public Member Functions | |
| __construct (\DateTimeZone $timezone=null, $validate=true) | |
| decodeRequest ($URI) | |
| decodeResponse ($URI) | |
Protected Member Functions | |
| decodeValue (\XMLReader $reader, array $allowedTypes=array()) | |
| expectEndTag ($reader, $expectedTag) | |
| expectStartTag ($reader, $expectedTag) | |
| getReader ($URI, $request) | |
| parseText ($reader) | |
| prepareNextNode () | |
| readNode ($reader) | |
Static Protected Member Functions | |
| static | checkType (array $allowedTypes, $type, $value) |
Protected Attributes | |
| $currentNode | |
| The fpoirotte::XRL::Node currently being processed. | |
| $timezone | |
| Timezone used to decode date/times. | |
| $validate | |
| Whether the documents should be validated or not. | |
Static Protected Attributes | |
| static | $types |
| Names for the various types of XML nodes in libxml. More... | |
A decoder that can process XML-RPC requests and responses, with optional XML validation.
Definition at line 21 of file Decoder.php.
| fpoirotte\XRL\Decoder::__construct | ( | \DateTimeZone | $timezone = null, |
$validate = true |
|||
| ) |
Creates a new decoder.
| DateTimeZone | $timezone | (optional) Information on the timezone incoming date/times come from. If omitted, the machine's current timezone is used. |
| bool | $validate | (optional) Whether the decoder should validate its input (true) or not (false). Validation is enabled by default. |
| InvalidArgumentException | The value passed for $validate was not a boolean. |
Definition at line 71 of file Decoder.php.
References fpoirotte\XRL\Decoder\$timezone, and fpoirotte\XRL\Decoder\$validate.
|
staticprotected |
Check the type of a value.
| array | $allowedTypes | Whitelist of allowed types. If empty, any type is allowed. |
| string | $type | The actual type of the value being tested. |
| mixed | $value | The value being tested. |
| mixed | The original value that was passed to this method, if type allows. |
| InvalidArgumentException | The given type cannot be used in this context (disallowed). |
Definition at line 310 of file Decoder.php.
| fpoirotte\XRL\Decoder::decodeRequest | ( | $URI | ) |
Decode an XML-RPC request.
| string | $URI | URI to XML-RPC request. |
| fpoirotte::XRL::Request | An object representing an XML-RPC request. |
| InvalidArgumentException | The given $data was invalid. For example, it wasn't a string, it didn"t contain any XML or the request was malformed. |
Implements fpoirotte\XRL\DecoderInterface.
Definition at line 490 of file Decoder.php.
References fpoirotte\XRL\Decoder\decodeValue(), fpoirotte\XRL\Decoder\expectEndTag(), fpoirotte\XRL\Decoder\expectStartTag(), fpoirotte\XRL\Decoder\getReader(), fpoirotte\XRL\Decoder\parseText(), and fpoirotte\XRL\Decoder\readNode().
| fpoirotte\XRL\Decoder::decodeResponse | ( | $URI | ) |
Decode an XML-RPC response.
| string | $URI | URI to the XML-RPC response. |
| mixed | The return value represented by the XML-RPC response. |
| fpoirotte::XRL::Exception | Thrown whenever the response described a failure. This exception's getCode() and getMessage() methods can be used to retrieve the original failure's code and description, respectively. |
| InvalidArgumentException | The given $data was invalid. For example, it wasn't a string, it didn"t contain any XML or the request was malformed. |
Implements fpoirotte\XRL\DecoderInterface.
Definition at line 560 of file Decoder.php.
References fpoirotte\XRL\Decoder\decodeValue(), fpoirotte\XRL\Decoder\expectEndTag(), fpoirotte\XRL\Decoder\expectStartTag(), fpoirotte\XRL\Decoder\getReader(), and fpoirotte\XRL\Decoder\readNode().
|
protected |
Decodes a value encoded using XML-RPC types.
| XMLReader | $reader | Reader the value will be read from. |
| array | $allowedTypes | Whitelist will the names of the types that are allowed in this context. |
| mixed | The value that was decoded, if any, with the appropriate PHP type. |
| InvalidArgumentException | No value could be decoded (probably because the input document was invalid) or the decoded value was of a type that is not allowed in this context. |
Definition at line 342 of file Decoder.php.
References fpoirotte\XRL\Decoder\$types, fpoirotte\XRL\Decoder\expectEndTag(), fpoirotte\XRL\Decoder\expectStartTag(), fpoirotte\XRL\Decoder\parseText(), and fpoirotte\XRL\Types\AbstractType\read().
Referenced by fpoirotte\XRL\Decoder\decodeRequest(), and fpoirotte\XRL\Decoder\decodeResponse().
|
protected |
Read a node from the document and throw an exception if it is not a closing tag with the given name.
| XMLReader | $reader | Reader object the node will be read from. |
| string | $expectedTag | Name of the tag we're expecting. |
| InvalidArgumentException | Thrown whenever one of the following conditions is met:
|
Definition at line 230 of file Decoder.php.
References fpoirotte\XRL\Decoder\prepareNextNode(), and fpoirotte\XRL\Decoder\readNode().
Referenced by fpoirotte\XRL\Decoder\decodeRequest(), fpoirotte\XRL\Decoder\decodeResponse(), and fpoirotte\XRL\Decoder\decodeValue().
|
protected |
Read a node from the document and throw an exception if it is not an opening tag with the given name.
| XMLReader | $reader | Reader object the node will be read from. |
| string | $expectedTag | Name of the tag we're expecting. |
| InvalidArgumentException | Thrown whenever one of the following conditions is met:
|
Definition at line 188 of file Decoder.php.
References fpoirotte\XRL\Decoder\prepareNextNode(), and fpoirotte\XRL\Decoder\readNode().
Referenced by fpoirotte\XRL\Decoder\decodeRequest(), fpoirotte\XRL\Decoder\decodeResponse(), and fpoirotte\XRL\Decoder\decodeValue().
|
protected |
Returns an XML reader for some data.
| string | $URI | URI to the XML data to process. |
| bool | $request | Whether the data refers to an XML-RPC request (true) or a response (false). |
| XMLReader | An XML reader for the given data. |
| InvalidArgumentException | You tried to pass something that is not a boolean as the $request parameter. |
Definition at line 114 of file Decoder.php.
Referenced by fpoirotte\XRL\Decoder\decodeRequest(), and fpoirotte\XRL\Decoder\decodeResponse().
|
protected |
Read a node from the document and throw an exception if it is not a text node. Otherwise, return its content.
| XMLReader | $reader | Reader object the node will be read from. |
| string | The value of the text node. |
| InvalidArgumentException | Thrown whenever one of the following conditions is met:
|
Definition at line 270 of file Decoder.php.
References fpoirotte\XRL\Decoder\prepareNextNode(), and fpoirotte\XRL\Decoder\readNode().
Referenced by fpoirotte\XRL\Decoder\decodeRequest(), and fpoirotte\XRL\Decoder\decodeValue().
|
protected |
Prepare for the next XML node read. This method should be called after each successful node parsing.
Definition at line 162 of file Decoder.php.
Referenced by fpoirotte\XRL\Decoder\expectEndTag(), fpoirotte\XRL\Decoder\expectStartTag(), and fpoirotte\XRL\Decoder\parseText().
|
protected |
Read a node from the XML reader and return it.
| XMLReader | $reader | Reader to read the node from. |
| fpoirotte::XRL::Node | The XML node that's been read. |
Definition at line 147 of file Decoder.php.
References fpoirotte\XRL\Decoder\$currentNode.
Referenced by fpoirotte\XRL\Decoder\decodeRequest(), fpoirotte\XRL\Decoder\decodeResponse(), fpoirotte\XRL\Decoder\expectEndTag(), fpoirotte\XRL\Decoder\expectStartTag(), and fpoirotte\XRL\Decoder\parseText().
|
staticprotected |
Names for the various types of XML nodes in libxml.
Definition at line 33 of file Decoder.php.
Referenced by fpoirotte\XRL\Decoder\decodeValue().