public function serializeToString($rec = -1)
    {
        $string = '';
        // wired and type
        if ($rec > -1) {
            $string .= $this->base128->setValue($rec << 3 | $this->wired_type);
        }

        $stringinner = '';

        foreach ($this->fields as $index => $field) {
            if (is_array($this->values[$index]) && count($this->values[$index]) > 0) {
                // make serialization for every array
                foreach ($this->values[$index] as $array) {
                    $newstring = '';

                    if (method_exists($array, 'serializeToString')) {
                        $newstring .= $array->serializeToString($index);
                    }

                    $stringinner .= $newstring;
                }
            } elseif ($this->values[$index] !== null) {
                // wired and type
                $newstring = '';
                if (method_exists($this->values[$index], 'serializeToString')) {
                    $newstring .= $this->values[$index]->serializeToString($index);
                }

                $stringinner .= $newstring;
            }
        }

        $this->serializeChunk($stringinner);

        if ($this->wired_type === PBMessage::WIRED_LENGTH_DELIMITED && $rec > -1) {
            $stringinner = $this->base128->setValue(strlen($stringinner) / PBMessage::MODUS) . $stringinner;
        }

        return $string . $stringinner;
    }
public function serializeToString($rec = -1)
    {
        $string = '';
        // wired and type
        if ($rec > -1) {
            $string .= $this->base128->setValue($rec << 3 | $this->wired_type);
        }

        $stringinner = '';

        foreach ($this->fields as $index => $field) {
            if (is_array($this->values[$index]) && count($this->values[$index]) > 0) {
                // make serialization for every array
                foreach ($this->values[$index] as $array) {
                    $newstring = '';

                    if (method_exists($array, 'serializeToString')) {
                        $newstring .= $array->serializeToString($index);
                    }

                    $stringinner .= $newstring;
                }
            } elseif ($this->values[$index] !== null) {
                // wired and type
                $newstring = '';
                if (method_exists($this->values[$index], 'serializeToString')) {
                    $newstring .= $this->values[$index]->serializeToString($index);
                }

                $stringinner .= $newstring;
            }
        }

        $this->serializeChunk($stringinner);

        if ($this->wired_type === PBMessage::WIRED_LENGTH_DELIMITED && $rec > -1) {
            $stringinner = $this->base128->setValue(strlen($stringinner) / PBMessage::MODUS) . $stringinner;
        }

        return $string . $stringinner;
    }
public function serializeToString ( $ rec = - 1 ) { $ string = '' ; // wired and type
 if ( $ rec > - 1 ) { $ string .= $ this -> base128 -> setValue ( $ rec << 3 | $ this -> wired_type ) ; } $ stringinner = '' ; foreach ( $ this -> fields as $ index => $ field ) { if ( is_array ( $ this -> values [ $ index ] ) && count ( $ this -> values [ $ index ] ) > 0 ) { // make serialization for every array
 foreach ( $ this -> values [ $ index ] as $ array ) { $ newstring = '' ; if ( method_exists ( $ array , 'serializeToString' ) ) { $ newstring .= $ array -> serializeToString ( $ index ) ; } $ stringinner .= $ newstring ; } } elseif ( $ this -> values [ $ index ] !== null ) { // wired and type
 $ newstring = '' ; if ( method_exists ( $ this -> values [ $ index ] , 'serializeToString' ) ) { $ newstring .= $ this -> values [ $ index ] -> serializeToString ( $ index ) ; } $ stringinner .= $ newstring ; } } $ this -> serializeChunk ( $ stringinner ) ; if ( $ this -> wired_type === PBMessage :: WIRED_LENGTH_DELIMITED && $ rec > - 1 ) { $ stringinner = $ this -> base128 -> setValue ( strlen ( $ stringinner ) / PBMessage :: MODUS ) . $ stringinner ; } return $ string . $ stringinner ; }
Encodes a Message
@param mixed $rec
@return string the encoded message
Encodes a Message