Пример #1
0
 public function __construct($trans)
 {
     $this->contexts = new \HH\Vector(array());
     if (!$trans instanceof IThriftBufferedTransport) {
         $trans = new TBufferedTransport($trans);
     }
     $this->bufTrans = $trans;
     parent::__construct($trans);
     $this->contexts->add(new TSimpleJSONProtocolContext($this->trans_, $this->bufTrans));
 }
Пример #2
0
 public function __construct($trans, $strictRead = false, $strictWrite = true)
 {
     parent::__construct($trans);
     $this->strictRead_ = $strictRead;
     $this->strictWrite_ = $strictWrite;
     if (\hacklib_equals(pack("S", 1), "")) {
         $this->littleendian_ = true;
     }
     $this->memory_limit = self::getBytes(ini_get("memory_limit"));
 }
Пример #3
0
 public function __construct($trans, $strictRead = false, $strictWrite = true)
 {
     parent::__construct($trans);
     $this->strictRead_ = $strictRead;
     $this->strictWrite_ = $strictWrite;
     if (pack('S', 1) == "") {
         $this->littleendian_ = true;
     }
     $this->memory_limit = self::getBytes(ini_get('memory_limit'));
 }
Пример #4
0
 public function write(TProtocol $output)
 {
     $xfer = 0;
     $xfer += $output->writeStructBegin('Person');
     if ($this->id !== null) {
         $xfer += $output->writeFieldBegin('id', TType::I64, 1);
         $xfer += $output->writeI64($this->id);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->name !== null) {
         $xfer += $output->writeFieldBegin('name', TType::STRING, 2);
         $xfer += $output->writeString($this->name);
         $xfer += $output->writeFieldEnd();
     }
     if (isset($this->age) && $this->age !== null) {
         $xfer += $output->writeFieldBegin('age', TType::I16, 3);
         $xfer += $output->writeI16($this->age);
         $xfer += $output->writeFieldEnd();
     }
     if (isset($this->address) && $this->address !== null) {
         $xfer += $output->writeFieldBegin('address', TType::STRING, 4);
         $xfer += $output->writeString($this->address);
         $xfer += $output->writeFieldEnd();
     }
     if (isset($this->favoriteColor) && $this->favoriteColor !== null) {
         if (!is_object($this->favoriteColor)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('favoriteColor', TType::STRUCT, 5);
         $xfer += $this->favoriteColor->write($output);
         $xfer += $output->writeFieldEnd();
     }
     if (isset($this->friends) && $this->friends !== null) {
         if (!is_array($this->friends) && !(($this->friends instanceof Iterator || $this->friends instanceof IteratorAggregate) && $this->friends instanceof Countable)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('friends', TType::SET, 6);
         $output->writeSetBegin(TType::I64, count($this->friends));
         foreach ($this->friends as $iter0 => $true) {
             $xfer += $output->writeI64($iter0);
         }
         $output->writeSetEnd();
         $xfer += $output->writeFieldEnd();
     }
     if (isset($this->bestFriend) && $this->bestFriend !== null) {
         $xfer += $output->writeFieldBegin('bestFriend', TType::I64, 7);
         $xfer += $output->writeI64($this->bestFriend);
         $xfer += $output->writeFieldEnd();
     }
     if (isset($this->petNames) && $this->petNames !== null) {
         if (!is_array($this->petNames) && !(($this->petNames instanceof Iterator || $this->petNames instanceof IteratorAggregate) && $this->petNames instanceof Countable)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('petNames', TType::MAP, 8);
         $output->writeMapBegin(TType::I32, TType::STRING, count($this->petNames));
         foreach ($this->petNames as $kiter1 => $viter2) {
             $xfer += $output->writeI32($kiter1);
             $xfer += $output->writeString($viter2);
         }
         $output->writeMapEnd();
         $xfer += $output->writeFieldEnd();
     }
     if (isset($this->afraidOfAnimal) && $this->afraidOfAnimal !== null) {
         $xfer += $output->writeFieldBegin('afraidOfAnimal', TType::I32, 9);
         $xfer += $output->writeI32($this->afraidOfAnimal);
         $xfer += $output->writeFieldEnd();
     }
     if (isset($this->vehicles) && $this->vehicles !== null) {
         if (!is_array($this->vehicles) && !(($this->vehicles instanceof Iterator || $this->vehicles instanceof IteratorAggregate) && $this->vehicles instanceof Countable)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('vehicles', TType::LST, 10);
         $output->writeListBegin(TType::STRUCT, count($this->vehicles));
         foreach ($this->vehicles as $iter3) {
             $xfer += $iter3->write($output);
         }
         $output->writeListEnd();
         $xfer += $output->writeFieldEnd();
     }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
 }
Пример #5
0
 public function __construct($trans, $strictRead = false, $strictWrite = true)
 {
     parent::__construct($trans);
     $this->strictRead_ = $strictRead;
     $this->strictWrite_ = $strictWrite;
 }
Пример #6
0
 public function write(TProtocol $output)
 {
     $xfer = 0;
     $xfer += $output->writeStructBegin('Internship');
     if ($this->weeks !== null) {
         $xfer += $output->writeFieldBegin('weeks', TType::I32, 1);
         $xfer += $output->writeI32($this->weeks);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->title !== null) {
         $xfer += $output->writeFieldBegin('title', TType::STRING, 2);
         $xfer += $output->writeString($this->title);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->employer !== null) {
         $xfer += $output->writeFieldBegin('employer', TType::I32, 3);
         $xfer += $output->writeI32($this->employer);
         $xfer += $output->writeFieldEnd();
     }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
 }
Пример #7
0
 public function write(TProtocol $output)
 {
     $xfer = 0;
     $xfer += $output->writeStructBegin('Range');
     if ($this->min !== null) {
         $xfer += $output->writeFieldBegin('min', TType::I32, 1);
         $xfer += $output->writeI32($this->min);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->max !== null) {
         $xfer += $output->writeFieldBegin('max', TType::I32, 2);
         $xfer += $output->writeI32($this->max);
         $xfer += $output->writeFieldEnd();
     }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
 }
Пример #8
0
 public function __construct($trans)
 {
     parent::__construct($trans);
 }
 public function __construct($val)
 {
     $this->top = new ArrayIterator(array($val));
     $this->stack = new \HH\Vector(array($this->top));
     parent::__construct(new TNullTransport());
 }