Esempio n. 1
0
 /**
  * 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 PhpAmqpLib_Exception_AMQPOutOfBoundsException("Table is longer than supported");
     }
     $table_data = new PhpAmqpLib_Wire_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;
 }
Esempio n. 2
0
 /**
  * Read an AMQP table, and return as a PHP array. keys are strings,
  * values are (type,value) tuples.
  *
  * @param bool $returnObject Whether to return PhpAmqpLib_Wire_AMQPArray instance instead of plain array
  * @return array|PhpAmqpLib_Wire_AMQPTable
  */
 public function read_table($returnObject = false)
 {
     $this->bitcount = $this->bits = 0;
     $tlen = $this->read_php_int();
     if ($tlen < 0) {
         throw new PhpAmqpLib_Exception_AMQPOutOfBoundsException('Table is longer than supported');
     }
     $table_data = new PhpAmqpLib_Wire_AMQPReader($this->rawread($tlen), null);
     $result = $returnObject ? new PhpAmqpLib_Wire_AMQPTable() : array();
     while ($table_data->tell() < $tlen) {
         $name = $table_data->read_shortstr();
         $ftype = PhpAmqpLib_Wire_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;
 }
Esempio n. 3
0
 /**
  * @param PhpAmqpLib_Wire_AMQPReader $args
  * @return array
  */
 public static function basicGetEmpty($args)
 {
     $ret = array();
     $ret[] = $args->read_shortstr();
     return $ret;
 }
 /**
  * Handles connection blocked notifications
  *
  * @param PhpAmqpLib_Wire_AMQPReader $args
  */
 protected function connection_blocked(PhpAmqpLib_Wire_AMQPReader $args)
 {
     // Call the block handler and pass in the reason
     $this->dispatch_to_handler($this->connection_block_handler, array($args->read_shortstr()));
 }
Esempio n. 5
0
 /**
  * Returns a failed message
  *
  * @param PhpAmqpLib_Wire_AMQPReader $args
  * @param PhpAmqpLib_Message_AMQPMessage $msg
  */
 protected function basic_return($args, $msg)
 {
     $reply_code = $args->read_short();
     $reply_text = $args->read_shortstr();
     $exchange = $args->read_shortstr();
     $routing_key = $args->read_shortstr();
     if (null !== $this->basic_return_callback) {
         call_user_func_array($this->basic_return_callback, array($reply_code, $reply_text, $exchange, $routing_key, $msg));
     } elseif ($this->debug) {
         PhpAmqpLib_Helper_MiscHelper::debug_msg('Skipping unhandled basic_return message');
     }
 }
Esempio n. 6
0
 /**
  * @param PhpAmqpLib_Wire_AMQPReader $args
  * @return array
  */
 public static function streamCancelOk($args)
 {
     $ret = array();
     $ret[] = $args->read_shortstr();
     return $ret;
 }