public static function encode(TagContext $tagContext): string
    {
        $str = self::TAGS_VERSION_ID;
        /** @var Tag $tag */
        foreach ($tagContext->tags() as $tag) {
            $str .= self::KEYTYPE_STRING;
            $key = $tag->getKey()->getName();
            $buf = '';
            self::encodeUnsigned($buf, strlen($key));
            $str .= $buf . $key;
            $value = $tag->getValue()->getValue();
            $buf = '';
            self::encodeUnsigned($buf, strlen($value));
            $str .= $buf . $value;
        }
        return $str;
    }