Xml.php
public static function fromArray($input, array $options = [])
    {
        if (!\is_array($input) || \count($input) !== 1) {
            throw new \RuntimeException(Tools::poorManTranslate('fts-shared', 'Invalid input.'));
        }
        $key = key($input);
        if (\is_int($key)) {
            throw new \RuntimeException(Tools::poorManTranslate('fts-shared', 'The key of input must be alphanumeric.'));
        }

        if (!\is_array($options)) {
            $options = ['format' => (string)$options];
        }
        $defaults = [
            'format' => 'tags',
            'version' => '1.0',
            'encoding' => 'utf-8',
            'return' => 'simplexml',
        ];
        $options = array_merge($defaults, $options);

        $dom = new \DOMDocument($options['version'], $options['encoding']);
        self::_fromArray($dom, $dom, $input, $options['format']);

        $options['return'] = strtolower($options['return']);
        if ($options['return'] === 'simplexml' || $options['return'] === 'simplexmlelement') {
            return new \SimpleXMLElement($dom->saveXML());
        }

        return $dom;
    }
public static function fromArray($input, array $options = [])
    {
        if (!\is_array($input) || \count($input) !== 1) {
            throw new \RuntimeException(Tools::poorManTranslate('fts-shared', 'Invalid input.'));
        }
        $key = key($input);
        if (\is_int($key)) {
            throw new \RuntimeException(Tools::poorManTranslate('fts-shared', 'The key of input must be alphanumeric.'));
        }

        if (!\is_array($options)) {
            $options = ['format' => (string)$options];
        }
        $defaults = [
            'format' => 'tags',
            'version' => '1.0',
            'encoding' => 'utf-8',
            'return' => 'simplexml',
        ];
        $options = array_merge($defaults, $options);

        $dom = new \DOMDocument($options['version'], $options['encoding']);
        self::_fromArray($dom, $dom, $input, $options['format']);

        $options['return'] = strtolower($options['return']);
        if ($options['return'] === 'simplexml' || $options['return'] === 'simplexmlelement') {
            return new \SimpleXMLElement($dom->saveXML());
        }

        return $dom;
    }
Transform an array into a SimpleXMLElement

### Options

- `format` If create childs ('tags') or attributes ('attribute').
- `version` Version of XML document. Default is 1.0.
- `encoding` Encoding of XML document. If null remove from XML header. Default is the some of application.
- `return` If return object of SimpleXMLElement ('simplexml') or DOMDocument ('domdocument'). Default is SimpleXMLElement.

Using the following data:

{{{
$value = array(
'root' => array(
'tag' => array(
'id' => 1,
'value' => 'defect',
'@' => 'description'
)
)
);
}}}

Calling `Xml::fromArray($value, 'tags');`  Will generate:

`<root><tag><id>1</id><value>defect</value>description</tag></root>`

And calling `Xml::fromArray($value, 'attribute');` Will generate:

`<root><tag id="1" value="defect">description</tag></root>`

@param array $input Array with data
@param array $options The options to use
@return \SimpleXMLElement|\DOMDocument SimpleXMLElement or DOMDocument
@throws \RuntimeException