Overview

Packages

  • None
  • Scribe

Classes

  • LogEntry
  • ResultCode
  • scribe_Log_args
  • scribe_Log_result
  • scribeClient
  • scribeProcessor

Interfaces

  • Horde_Scribe
  • scribeIf
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Autogenerated by Thrift
  4:  *
  5:  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  6:  */
  7: include_once $GLOBALS['THRIFT_ROOT'].'/Thrift.php';
  8: 
  9: include_once $GLOBALS['THRIFT_ROOT'].'/packages/scribe/scribe_types.php';
 10: include_once $GLOBALS['THRIFT_ROOT'].'/packages/fb303/FacebookService.php';
 11: 
 12: interface scribeIf extends FacebookServiceIf {
 13:   public function Log($messages);
 14: }
 15: 
 16: class scribeClient extends FacebookServiceClient implements scribeIf {
 17:   public function __construct($input, $output=null) {
 18:     parent::__construct($input, $output);
 19:   }
 20: 
 21:   public function Log($messages)
 22:   {
 23:     $this->send_Log($messages);
 24:     return $this->recv_Log();
 25:   }
 26: 
 27:   public function send_Log($messages)
 28:   {
 29:     $args = new scribe_Log_args();
 30:     $args->messages = $messages;
 31:     $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary');
 32:     if ($bin_accel)
 33:     {
 34:       thrift_protocol_write_binary($this->output_, 'Log', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
 35:     }
 36:     else
 37:     {
 38:       $this->output_->writeMessageBegin('Log', TMessageType::CALL, $this->seqid_);
 39:       $args->write($this->output_);
 40:       $this->output_->writeMessageEnd();
 41:       $this->output_->getTransport()->flush();
 42:     }
 43:   }
 44: 
 45:   public function recv_Log()
 46:   {
 47:     $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary');
 48:     if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, 'scribe_Log_result', $this->input_->isStrictRead());
 49:     else
 50:     {
 51:       $rseqid = 0;
 52:       $fname = null;
 53:       $mtype = 0;
 54: 
 55:       $this->input_->readMessageBegin($fname, $mtype, $rseqid);
 56:       if ($mtype == TMessageType::EXCEPTION) {
 57:         $x = new TApplicationException();
 58:         $x->read($this->input_);
 59:         $this->input_->readMessageEnd();
 60:         throw $x;
 61:       }
 62:       $result = new scribe_Log_result();
 63:       $result->read($this->input_);
 64:       $this->input_->readMessageEnd();
 65:     }
 66:     if ($result->success !== null) {
 67:       return $result->success;
 68:     }
 69:     throw new Exception("Log failed: unknown result");
 70:   }
 71: 
 72: }
 73: 
 74: // HELPER FUNCTIONS AND STRUCTURES
 75: 
 76: class scribe_Log_args {
 77:   static $_TSPEC;
 78: 
 79:   public $messages = null;
 80: 
 81:   public function __construct($vals=null) {
 82:     if (!isset(self::$_TSPEC)) {
 83:       self::$_TSPEC = array(
 84:         1 => array(
 85:           'var' => 'messages',
 86:           'type' => TType::LST,
 87:           'etype' => TType::STRUCT,
 88:           'elem' => array(
 89:             'type' => TType::STRUCT,
 90:             'class' => 'LogEntry',
 91:             ),
 92:           ),
 93:         );
 94:     }
 95:     if (is_array($vals)) {
 96:       if (isset($vals['messages'])) {
 97:         $this->messages = $vals['messages'];
 98:       }
 99:     }
100:   }
101: 
102:   public function getName() {
103:     return 'scribe_Log_args';
104:   }
105: 
106:   public function read($input)
107:   {
108:     $xfer = 0;
109:     $fname = null;
110:     $ftype = 0;
111:     $fid = 0;
112:     $xfer += $input->readStructBegin($fname);
113:     while (true)
114:     {
115:       $xfer += $input->readFieldBegin($fname, $ftype, $fid);
116:       if ($ftype == TType::STOP) {
117:         break;
118:       }
119:       switch ($fid)
120:       {
121:         case 1:
122:           if ($ftype == TType::LST) {
123:             $this->messages = array();
124:             $_size0 = 0;
125:             $_etype3 = 0;
126:             $xfer += $input->readListBegin($_etype3, $_size0);
127:             for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
128:             {
129:               $elem5 = null;
130:               $elem5 = new LogEntry();
131:               $xfer += $elem5->read($input);
132:               $this->messages []= $elem5;
133:             }
134:             $xfer += $input->readListEnd();
135:           } else {
136:             $xfer += $input->skip($ftype);
137:           }
138:           break;
139:         default:
140:           $xfer += $input->skip($ftype);
141:           break;
142:       }
143:       $xfer += $input->readFieldEnd();
144:     }
145:     $xfer += $input->readStructEnd();
146:     return $xfer;
147:   }
148: 
149:   public function write($output) {
150:     $xfer = 0;
151:     $xfer += $output->writeStructBegin('scribe_Log_args');
152:     if ($this->messages !== null) {
153:       if (!is_array($this->messages)) {
154:         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
155:       }
156:       $xfer += $output->writeFieldBegin('messages', TType::LST, 1);
157:       {
158:         $output->writeListBegin(TType::STRUCT, count($this->messages));
159:         {
160:           foreach ($this->messages as $iter6)
161:           {
162:             $xfer += $iter6->write($output);
163:           }
164:         }
165:         $output->writeListEnd();
166:       }
167:       $xfer += $output->writeFieldEnd();
168:     }
169:     $xfer += $output->writeFieldStop();
170:     $xfer += $output->writeStructEnd();
171:     return $xfer;
172:   }
173: 
174: }
175: 
176: class scribe_Log_result {
177:   static $_TSPEC;
178: 
179:   public $success = null;
180: 
181:   public function __construct($vals=null) {
182:     if (!isset(self::$_TSPEC)) {
183:       self::$_TSPEC = array(
184:         0 => array(
185:           'var' => 'success',
186:           'type' => TType::I32,
187:           ),
188:         );
189:     }
190:     if (is_array($vals)) {
191:       if (isset($vals['success'])) {
192:         $this->success = $vals['success'];
193:       }
194:     }
195:   }
196: 
197:   public function getName() {
198:     return 'scribe_Log_result';
199:   }
200: 
201:   public function read($input)
202:   {
203:     $xfer = 0;
204:     $fname = null;
205:     $ftype = 0;
206:     $fid = 0;
207:     $xfer += $input->readStructBegin($fname);
208:     while (true)
209:     {
210:       $xfer += $input->readFieldBegin($fname, $ftype, $fid);
211:       if ($ftype == TType::STOP) {
212:         break;
213:       }
214:       switch ($fid)
215:       {
216:         case 0:
217:           if ($ftype == TType::I32) {
218:             $xfer += $input->readI32($this->success);
219:           } else {
220:             $xfer += $input->skip($ftype);
221:           }
222:           break;
223:         default:
224:           $xfer += $input->skip($ftype);
225:           break;
226:       }
227:       $xfer += $input->readFieldEnd();
228:     }
229:     $xfer += $input->readStructEnd();
230:     return $xfer;
231:   }
232: 
233:   public function write($output) {
234:     $xfer = 0;
235:     $xfer += $output->writeStructBegin('scribe_Log_result');
236:     if ($this->success !== null) {
237:       $xfer += $output->writeFieldBegin('success', TType::I32, 0);
238:       $xfer += $output->writeI32($this->success);
239:       $xfer += $output->writeFieldEnd();
240:     }
241:     $xfer += $output->writeFieldStop();
242:     $xfer += $output->writeStructEnd();
243:     return $xfer;
244:   }
245: 
246: }
247: 
248: class scribeProcessor extends FacebookServiceProcessor {
249:   public function __construct($handler) {
250:     parent::__construct($handler);
251:   }
252: 
253:   public function process($input, $output) {
254:     $rseqid = 0;
255:     $fname = null;
256:     $mtype = 0;
257: 
258:     $input->readMessageBegin($fname, $mtype, $rseqid);
259:     $methodname = 'process_'.$fname;
260:     if (!method_exists($this, $methodname)) {
261:       $input->skip(TType::STRUCT);
262:       $input->readMessageEnd();
263:       $x = new TApplicationException('Function '.$fname.' not implemented.', TApplicationException::UNKNOWN_METHOD);
264:       $output->writeMessageBegin($fname, TMessageType::EXCEPTION, $rseqid);
265:       $x->write($output);
266:       $output->writeMessageEnd();
267:       $output->getTransport()->flush();
268:       return;
269:     }
270:     $this->$methodname($rseqid, $input, $output);
271:     return true;
272:   }
273: 
274:   protected function process_Log($seqid, $input, $output) {
275:     $args = new scribe_Log_args();
276:     $args->read($input);
277:     $input->readMessageEnd();
278:     $result = new scribe_Log_result();
279:     $result->success = $this->handler_->Log($args->messages);
280:     $output->writeMessageBegin('Log', TMessageType::REPLY, $seqid);
281:     $result->write($output);
282:     $output->getTransport()->flush();
283:   }
284: }
285: ?>
286: 
API documentation generated by ApiGen