inc\classes\help\classes\ArrayToXml.phpView Source

Show: PublicProtectedPrivateinherited
Table of Contents
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

>VPropertyprotected\DOMDocument $document
The root DOM Document.
Details
Type
\DOMDocument
>VPropertyprotectedboolean $replaceSpacesByUnderScoresInKeyNames = true
Set to enable replacing space with underscore.
Default valuetrueDetails
Type
boolean

Methods

methodpublic__construct(array<mixed,string> $array, string | array $rootElement = '', boolean $replaceSpacesByUnderScoresInKeyNames = true, string $xmlEncoding = null, string $xmlVersion = '1.0') : void

Construct a new instance.

Parameters
NameTypeDescription
$arrayarray<mixed,string>
$rootElementstring | array
$replaceSpacesByUnderScoresInKeyNamesboolean
$xmlEncodingstring
$xmlVersionstring
Throws
ExceptionDescription
\DOMException
methodprotectedaddAttributes(\DOMElement $element, array<mixed,string> $data) : void

Add attributes.

Parameters
NameTypeDescription
$element\DOMElement
$dataarray<mixed,string>
methodprotectedaddNode(\DOMElement $element, string $key, string | array<mixed,string> $value) : void

Add node.

Parameters
NameTypeDescription
$element\DOMElement
$keystring
$valuestring | array<mixed,string>
methodpublicconvert(array<mixed,string> $array, string $rootElementName = '', boolean $replaceSpacesByUnderScoresInKeyNames = true, string $xmlEncoding = null, string $xmlVersion = '1.0') : string
static

Convert the given array to an xml string.

Parameters
NameTypeDescription
$arrayarray<mixed,string>
$rootElementNamestring
$replaceSpacesByUnderScoresInKeyNamesboolean
$xmlEncodingstring
$xmlVersionstring
Returns
TypeDescription
string
methodprivateconvertElement(\DOMElement $element, string | array<mixed,string> $value) : void

Parse individual element.

Parameters
NameTypeDescription
$element\DOMElement
$valuestring | array<mixed,string>
methodprotectedcreateRootElement(string | array $rootElement) : \DOMElement

Create the root element.

Parameters
NameTypeDescription
$rootElementstring | array
Returns
TypeDescription
\DOMElement
methodprotectedisArrayAllKeySequential(array | string $value) : boolean

Check if array are all sequential.

Parameters
NameTypeDescription
$valuearray | string
Returns
TypeDescription
boolean
methodpublictoDom() : \DOMDocument

Return as DOM object.

Returns
TypeDescription
\DOMDocument
methodpublictoXml() : string

Return as XML.

Returns
TypeDescription
string
Documentation was generated by phpDocumentor v2.9.0.