inc\classes\help\classes\ArrayToXml.php
Class
- Package
- Temply-Account\Helpers
\HelpClasses\ArrayToXml
Package: Temply-Account\Helpers






Converting Arrays to XML's
Simple class for converting Arrays to XML's
Properties
Methods

__construct(array<mixed,string> $array, string | array $rootElement = '', boolean $replaceSpacesByUnderScoresInKeyNames = true, string $xmlEncoding = null, string $xmlVersion = '1.0') : voidConstruct a new instance.
Parameters
Throws
| Name | Type | Description |
|---|---|---|
| $array | array<mixed,string> | |
| $rootElement | string | array | |
| $replaceSpacesByUnderScoresInKeyNames | boolean | |
| $xmlEncoding | string | |
| $xmlVersion | string |
| Exception | Description |
|---|---|
| \DOMException |

addAttributes(\DOMElement $element, array<mixed,string> $data) : voidAdd attributes.
Parameters
| Name | Type | Description |
|---|---|---|
| $element | \DOMElement | |
| $data | array<mixed,string> |

addNode(\DOMElement $element, string $key, string | array<mixed,string> $value) : voidAdd node.
Parameters
| Name | Type | Description |
|---|---|---|
| $element | \DOMElement | |
| $key | string | |
| $value | string | array<mixed,string> |

convert(array<mixed,string> $array, string $rootElementName = '', boolean $replaceSpacesByUnderScoresInKeyNames = true, string $xmlEncoding = null, string $xmlVersion = '1.0') : stringstatic
Convert the given array to an xml string.
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $array | array<mixed,string> | |
| $rootElementName | string | |
| $replaceSpacesByUnderScoresInKeyNames | boolean | |
| $xmlEncoding | string | |
| $xmlVersion | string |
| Type | Description |
|---|---|
| string |

convertElement(\DOMElement $element, string | array<mixed,string> $value) : voidParse individual element.
Parameters
| Name | Type | Description |
|---|---|---|
| $element | \DOMElement | |
| $value | string | array<mixed,string> |

createRootElement(string | array $rootElement) : \DOMElementCreate the root element.
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $rootElement | string | array |
| Type | Description |
|---|---|
| \DOMElement |

isArrayAllKeySequential(array | string $value) : booleanCheck if array are all sequential.
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $value | array | string |
| Type | Description |
|---|---|
| boolean |