XRL  latest
Simple XML-RPC Library (both client and server)
fpoirotte\XRL\Encoder Class Reference

An XML-RPC encoder that can produce either compact documents or pretty documents. More...

+ Inheritance diagram for fpoirotte\XRL\Encoder:

Public Member Functions

 __construct (\DateTimeZone $timezone=null, $indent=false, $stringTag=false)
 
 encodeError (\Exception $error)
 
 encodeRequest (\fpoirotte\XRL\Request $request)
 
 encodeResponse ($response)
 

Protected Member Functions

 finalizeWrite (\XMLWriter $writer)
 
 getWriter ()
 

Protected Attributes

 $indent
 Whether the output should be indented (true) or not (false).
 
 $stringTag
 Whether the "\<string\>" tag should be used (true) or not (false).
 
 $timezone
 Timezone used to encode date/times.
 

Detailed Description

An XML-RPC encoder that can produce either compact documents or pretty documents.

Authors
François Poirotte click.nosp@m.y@er.nosp@m.ebot..nosp@m.net

Definition at line 21 of file Encoder.php.

Constructor & Destructor Documentation

fpoirotte\XRL\Encoder::__construct ( \DateTimeZone  $timezone = null,
  $indent = false,
  $stringTag = false 
)

Create a new XML-RPC encoder.

Parameters
DateTimeZone$timezone(optional) Information on the timezone for which date/times should be encoded. If omitted, the machine's current timezone is used.
bool$indent(optional) Whether the XML produced should be indented (true) or not (false). Defaults to no indentation.
bool$stringTag(optional) Whether strings should be encoded explicitly using the <string> tag (true) or implicitly (false). Defaults to not using such tags.
Exceptions
InvalidArgumentExceptionAn invalid value was passed for either the $indent or $stringTag argument.

Definition at line 54 of file Encoder.php.

References fpoirotte\XRL\Encoder\$indent, fpoirotte\XRL\Encoder\$stringTag, and fpoirotte\XRL\Encoder\$timezone.

Member Function Documentation

fpoirotte\XRL\Encoder::encodeError ( \Exception  $error)

Encode an exception as an XML-RPC failure.

Parameters
Exception$errorThe exception to encode.
Return values
stringThe exception, encoded as a XML-RPC failure in serialized form.

Implements fpoirotte\XRL\EncoderInterface.

Definition at line 151 of file Encoder.php.

References fpoirotte\XRL\NativeEncoder\convert(), fpoirotte\XRL\Encoder\finalizeWrite(), and fpoirotte\XRL\Encoder\getWriter().

fpoirotte\XRL\Encoder::encodeRequest ( \fpoirotte\XRL\Request  $request)

Encode an XML-RPC request.

Parameters
fpoirotte::XRL::Request$requestThe XML-RPC request to encode.
Return values
stringThe XML-RPC request, encoded as serialized XML.

Implements fpoirotte\XRL\EncoderInterface.

Definition at line 129 of file Encoder.php.

References fpoirotte\XRL\Encoder\finalizeWrite(), and fpoirotte\XRL\Encoder\getWriter().

fpoirotte\XRL\Encoder::encodeResponse (   $response)

Encode an XML-RPC response.

Parameters
mixed$responseThe XML-RPC response to encode.
Return values
stringThe XML-RPC reponse, encoded as serialized XML.

Implements fpoirotte\XRL\EncoderInterface.

Definition at line 167 of file Encoder.php.

References fpoirotte\XRL\Encoder\finalizeWrite(), and fpoirotte\XRL\Encoder\getWriter().

fpoirotte\XRL\Encoder::finalizeWrite ( \XMLWriter  $writer)
protected

This method must be called when the document is complete and returns the document.

Parameters
XMLWriter$writerXML writer used to produce the document.
Return values
stringThe XML document that was generated, as serialized XML.

Definition at line 107 of file Encoder.php.

Referenced by fpoirotte\XRL\Encoder\encodeError(), fpoirotte\XRL\Encoder\encodeRequest(), and fpoirotte\XRL\Encoder\encodeResponse().

fpoirotte\XRL\Encoder::getWriter ( )
protected

Return an XML writer that will be used to produce XML-RPC requests and responses.

Return values
XMLWriterXML writer to use to produce documents.

Definition at line 82 of file Encoder.php.

Referenced by fpoirotte\XRL\Encoder\encodeError(), fpoirotte\XRL\Encoder\encodeRequest(), and fpoirotte\XRL\Encoder\encodeResponse().


The documentation for this class was generated from the following file: