XMLEncoder
About 1 min
XMLEncoder
Properties
outputOptions
Summary of outputOptions.
private array $outputOptionsMethods
__construct
Initializes a new instance of the Encoder class with optional output options.
public __construct(array $outputOptions): voidParameters
| Parameter | Type | Description |
|---|---|---|
$outputOptions | array | An associative array of output options to configure the XML output. Supported options are: - 'version': The XML version to use in the declaration (e.g., "1.0") - 'encoding': The character encoding to use in the declaration (e.g., "utf-8") - 'openTag': The string to use for opening tags (default is "<") - 'closeTag': The string to use for closing tags (default is ">") - 'newline': A string used for new lines (e.g., "\n") |
request
Creates a new XML-RPC request element.
public request(string $method, array $params, mixed $requestID): mixedParameters
| Parameter | Type | Description |
|---|---|---|
$method | string | the name of the method to be called |
$params | array | Optional. The parameters to pass to the method. |
$requestID | mixed |
response
Generates an XML-RPC method response element containing the given result.
public response(mixed $result, mixed $requestID): ElementParameters
| Parameter | Type | Description |
|---|---|---|
$result | mixed | the result value to be included in the response |
$requestID | mixed |
parse
Parses the given XML-RPC request element and returns an array representation.
public parse(string $xml, ?string $method, mixed $requestID): voidParameters
| Parameter | Type | Description |
|---|---|---|
$xml | string | the XML string of the request to be parsed |
$method | string | Optional. A variable to store the method name extracted from the request, if available. |
$requestID | mixed |
error
Creates an XML-RPC fault response element.
public error(\Throwable $throwable, mixed $requestID): ElementThis static method constructs an XML structure representing a fault response according to the XML-RPC specification. It includes the provided fault code and fault message in the appropriate XML format.
Parameters
| Parameter | Type | Description |
|---|---|---|
$throwable | \Throwable | |
$requestID | mixed |
encodeResponse
Encodes the given response into an XML response.
public encodeResponse(mixed $response): ResponseParameters
| Parameter | Type | Description |
|---|---|---|
$response | mixed | The response to encode. Must be an instance of Hazaar\XML\Element. |
encodeValue
private encodeValue(mixed $value): ElementParameters
| Parameter | Type | Description |
|---|---|---|
$value | mixed |
decodeValue
private decodeValue(Element $element): mixedParameters
| Parameter | Type | Description |
|---|---|---|
$element | Element |
Generated by Hazaar API Doc Generator on Sun, 01 Mar 2026 09:22:26 +0000