public static function matchTag($tag, $subject, &$content = null, &$attrs = null) {
        $xml = new \XMLReader();
        $xml->xml($subject, 'UTF-8', LIBXML_NOERROR | LIBXML_ERR_NONE);

        // failed to parse => false
        if ($xml->read() === false) {
            return false;
        }

        // wrong tag => false
        if ($xml->name !== $tag) {
            return false;
        }

        $attrs = [];
        while ($xml->moveToNextAttribute()) {
            $attrs[$xml->name] = $xml->value;
        }

        $content = $xml->readInnerXML();

        return true;
    }