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;
    }
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;
    }
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 ; }
Encode the provided TagContext to our binary wire format.

@param TagContext $tagContext the object holding the Tag's to encode.
@return string the bytestring holding our binary encoded Tag's.
Encode the provided TagContext to our binary wire format .