Translates XML into objects and objects into XML

 Methods

Create XML mapper

__construct() 

Create object from xml

fromXml(\Moneybird\SimpleXMLElement $xmlElement) 

access public

Parameters

Create object from xml string

fromXmlString(string $xmlstring) 

access public

Parameters

$xmlstring

string

Exceptions

\Moneybird\XmlMapper_InvalidXmlException

Returns the content type of mapped objects

getContentType() : string

Returns

string

Create object from string

mapFromStorage(string $string) : \Moneybird\Mapper_Mapable

access public

Parameters

$string

string

Returns

Map object

mapToStorage(\Moneybird\Mapper_Mapable $subject) : string

access public

Parameters

$subject

\Moneybird\Mapper_Mapable

Object to map

Returns

string

Convert to XML

toXML(\Moneybird\Mapper_Mapable $subject) : \Moneybird\SimpleXMLElement

access public

Parameters

$subject

\Moneybird\Mapper_Mapable

Object to map to XML

Returns

Convert to XML string

toXMLString(\Moneybird\Mapper_Mapable $subject) : string

access public

Parameters

$subject

\Moneybird\Mapper_Mapable

Object to map to XML

Returns

string

Cast value based on type

castValue(\Moneybird\SimpleXMLElement $xmlElement) : mixed

access protected

Parameters

Returns

mixed

Maps object to XML element-name

mapObjectToElementName(\Moneybird\Mapper_Mapable $subject) : string

access protected

Parameters

$subject

\Moneybird\Mapper_Mapable

Object to map to XML

Returns

string

Write property as xml key

propertyToXmlkey(string $key) : string

access protected

Parameters

$key

string

Returns

string

Callback to rewrite property to xml key

propertyToXmlkeyCallback(Array $match) : string

access protected

Parameters

$match

Array

Returns

string

Compare length of $a with length of $b

sortKeyLength(string $a, string $b) : int

Parameters

$a

string

$b

string

Returns

int

Test if $str ends with $end

strEndsWith(string $str, string $end) : bool

access protected

Parameters

$str

string

$end

string

Returns

bool

Map XMLelement to classname

xmlElementToClassname(\Moneybird\SimpleXMLElement $xmlElement) : string

access protected

Parameters

Returns

string

Write xml key as property

xmlkeyToProperty(string $key) : string

access protected

Parameters

$key

string

Returns

string

Callback to rewrite xml key to property

xmlkeyToPropertyCallback(Array $match) : string

access protected

Parameters

$match

Array

Returns

string

 Properties

 

Mapper for xml element names to class names

$objectMapper : Array