Beispiel #1
0
 public function write($output)
 {
     $xfer = 0;
     $xfer += $output->writeStructBegin('AutocompleteRequest');
     if ($this->userRecord !== null) {
         if (!is_object($this->userRecord)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('userRecord', TType::STRUCT, 11);
         $xfer += $this->userRecord->write($output);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->scope !== null) {
         $xfer += $output->writeFieldBegin('scope', TType::STRING, 21);
         $xfer += $output->writeString($this->scope);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->choiceId !== null) {
         $xfer += $output->writeFieldBegin('choiceId', TType::STRING, 31);
         $xfer += $output->writeString($this->choiceId);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->profileId !== null) {
         $xfer += $output->writeFieldBegin('profileId', TType::STRING, 41);
         $xfer += $output->writeString($this->profileId);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->requestContext !== null) {
         if (!is_object($this->requestContext)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('requestContext', TType::STRUCT, 51);
         $xfer += $this->requestContext->write($output);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->excludeVariantIds !== null) {
         if (!is_array($this->excludeVariantIds)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('excludeVariantIds', TType::SET, 61);
         $output->writeSetBegin(TType::STRING, count($this->excludeVariantIds));
         foreach ($this->excludeVariantIds as $iter214 => $iter215) {
             if (is_scalar($iter215)) {
                 $xfer += $output->writeString($iter214);
             } else {
                 $xfer += $output->writeString($iter215);
             }
         }
         $output->writeSetEnd();
         $xfer += $output->writeFieldEnd();
     }
     if ($this->autocompleteQuery !== null) {
         if (!is_object($this->autocompleteQuery)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('autocompleteQuery', TType::STRUCT, 71);
         $xfer += $this->autocompleteQuery->write($output);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->searchChoiceId !== null) {
         $xfer += $output->writeFieldBegin('searchChoiceId', TType::STRING, 81);
         $xfer += $output->writeString($this->searchChoiceId);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->searchQuery !== null) {
         if (!is_object($this->searchQuery)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('searchQuery', TType::STRUCT, 91);
         $xfer += $this->searchQuery->write($output);
         $xfer += $output->writeFieldEnd();
     }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
 }