コード例 #1
0
ファイル: AMQPReader.php プロジェクト: ohjack/newErp
 /**
  * Read an AMQP table, and return as a PHP array. keys are strings,
  * values are (type,value) tuples.
  */
 public function read_table()
 {
     $this->bitcount = $this->bits = 0;
     $tlen = $this->read_php_int();
     if ($tlen < 0) {
         throw new AMQPOutOfBoundsException("Table is longer than supported");
     }
     $table_data = new AMQPReader($this->rawread($tlen), null);
     $result = array();
     while ($table_data->tell() < $tlen) {
         $name = $table_data->read_shortstr();
         $ftype = $table_data->rawread(1);
         $val = $table_data->read_value($ftype);
         $result[$name] = array($ftype, $val);
     }
     return $result;
 }
コード例 #2
0
ファイル: AMQPReader.php プロジェクト: DBezemer/server
 /**
  * Read an AMQP table, and return as a PHP array. keys are strings,
  * values are (type,value) tuples.
  *
  * @param bool $returnObject Whether to return AMQPArray instance instead of plain array
  * @return array|AMQPTable
  */
 public function read_table($returnObject = false)
 {
     $this->bitcount = $this->bits = 0;
     $tlen = $this->read_php_int();
     if ($tlen < 0) {
         throw new AMQPOutOfBoundsException('Table is longer than supported');
     }
     $table_data = new AMQPReader($this->rawread($tlen), null);
     $result = $returnObject ? new AMQPTable() : array();
     while ($table_data->tell() < $tlen) {
         $name = $table_data->read_shortstr();
         $ftype = AMQPAbstractCollection::getDataTypeForSymbol($ftypeSym = $table_data->rawread(1));
         $val = $table_data->read_value($ftype, $returnObject);
         $returnObject ? $result->set($name, $val, $ftype) : ($result[$name] = array($ftypeSym, $val));
     }
     return $result;
 }