src/Viserio/Component/Parser/Parser/QtParser.php
public function parse(string $payload): array
    {
        try {
            $dom = XmlUtils::loadString($payload);
        } catch (InvalidArgumentException $exception) {
            throw new ParseException([
                'message' => $exception->getMessage(),
                'code'    => $exception->getCode(),
                'file'    => $exception->getFile(),
                'line'    => $exception->getLine(),
            ]);
        }

        $internalErrors = \libxml_use_internal_errors(true);

        \libxml_clear_errors();

        $xml   = XmlUtils::importDom($dom);
        $datas = [];

        foreach ((array) $xml->xpath('//TS/context') as $node) {
            $name         = (string) $node->name;
            $datas[$name] = [];

            foreach ($node->message as $message) {
                $translation           = $message->translation;
                $translationAttributes = (array) $translation->attributes();
                $attributes            = \reset($translationAttributes);

                $datas[$name][] = [
                    'source'      => (string) $message->source,
                    'translation' => [
                        'content'    => (string) $translation,
                        'attributes' => $attributes,
                    ],
                ];
            }
        }

        \libxml_use_internal_errors($internalErrors);

        return $datas;
    }
public function parse(string $payload): array
    {
        try {
            $dom = XmlUtils::loadString($payload);
        } catch (InvalidArgumentException $exception) {
            throw new ParseException([
                'message' => $exception->getMessage(),
                'code'    => $exception->getCode(),
                'file'    => $exception->getFile(),
                'line'    => $exception->getLine(),
            ]);
        }

        $internalErrors = \libxml_use_internal_errors(true);

        \libxml_clear_errors();

        $xml   = XmlUtils::importDom($dom);
        $datas = [];

        foreach ((array) $xml->xpath('//TS/context') as $node) {
            $name         = (string) $node->name;
            $datas[$name] = [];

            foreach ($node->message as $message) {
                $translation           = $message->translation;
                $translationAttributes = (array) $translation->attributes();
                $attributes            = \reset($translationAttributes);

                $datas[$name][] = [
                    'source'      => (string) $message->source,
                    'translation' => [
                        'content'    => (string) $translation,
                        'attributes' => $attributes,
                    ],
                ];
            }
        }

        \libxml_use_internal_errors($internalErrors);

        return $datas;
    }
{@inheritdoc}