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;
    }