/** * @param AMQPReader $reader * @return array */ public static function connectionStartOk(AMQPReader $reader) { $response = array(); $response[] = $reader->read_table(); $response[] = $reader->read_shortstr(); $response[] = $reader->read_longstr(); $response[] = $reader->read_shortstr(); return $response; }
/** * @param AMQPReader $args * @return array */ public static function connectionStartOk($args) { $ret = array(); $ret[] = $args->read_table(); $ret[] = $args->read_shortstr(); $ret[] = $args->read_longstr(); $ret[] = $args->read_shortstr(); return $ret; }
/** * Starts connection negotiation * * @param AMQPReader $args */ protected function connection_start($args) { $this->version_major = $args->read_octet(); $this->version_minor = $args->read_octet(); $this->server_properties = $args->read_table(); $this->mechanisms = explode(' ', $args->read_longstr()); $this->locales = explode(' ', $args->read_longstr()); $this->debug->debug_connection_start($this->version_major, $this->version_minor, $this->server_properties, $this->mechanisms, $this->locales); }
/** * start connection negotiation * * @param AMQPReader $args */ protected function connection_start($args) { $this->version_major = $args->read_octet(); $this->version_minor = $args->read_octet(); $this->server_properties = $args->read_table(); $this->mechanisms = explode(" ", $args->read_longstr()); $this->locales = explode(" ", $args->read_longstr()); if ($this->debug) { MiscHelper::debug_msg(sprintf("Start from server, version: %d.%d, properties: %s, mechanisms: %s, locales: %s", $this->version_major, $this->version_minor, self::dump_table($this->server_properties), implode(', ', $this->mechanisms), implode(', ', $this->locales))); } }
/** * Only for AMQP0.8.0 * This method allows the server to send a non-fatal warning to * the client. This is used for methods that are normally * asynchronous and thus do not have confirmations, and for which * the server may detect errors that need to be reported. Fatal * errors are handled as channel or connection exceptions; non- * fatal errors are sent through this method. * * @param AMQPReader $args */ protected function channel_alert($args) { $reply_code = $args->read_short(); $reply_text = $args->read_shortstr(); $details = $args->read_table(); array_push($this->alerts, array($reply_code, $reply_text, $details)); }
public function testTableWriteReadCollection() { $w = new AMQPWriter(); $w->write_table(new AMQPTable(array('long' => 12345, 'long_neg' => -12345, 'longlong' => 3000000000, 'longlong_neg' => -3000000000, 'float_low' => 9.2233720368548, 'float_high' => (double) 9.2233720368548E+18, 'bool_true' => true, 'bool_false' => false, 'array' => array(1, 2, 3, 'foo', array('bar' => 'baz'), array('boo', false, 5), true), 'array_empty' => array(), 'table' => array('foo' => 'bar', 'baz' => 'boo', 'bool' => true, 'tbl' => array('bar' => 'baz'), 'arr' => array('boo', false, 5)), 'table_num' => array(1 => 5, 3 => 'foo', 786 => 674), 'array_nested' => array(1, array(2, array(3, array(4)))), 'table_nested' => array('i' => 1, 'n' => array('i' => 2, 'n' => array('i' => 3, 'n' => array('i' => 4))))))); $r = new AMQPReader($w->getvalue()); //type casting - thanks to ancient phpunit on travis $this->assertEquals(array('long' => 12345, 'long_neg' => -12345, 'longlong' => (string) 3000000000, 'longlong_neg' => (string) -3000000000, 'float_low' => (string) (double) 9.2233720368548, 'float_high' => (string) (double) 9.2233720368548E+18, 'bool_true' => true, 'bool_false' => false, 'array' => array(1, 2, 3, 'foo', array('bar' => 'baz'), array('boo', false, 5), true), 'array_empty' => array(), 'table' => array('foo' => 'bar', 'baz' => 'boo', 'bool' => true, 'tbl' => array('bar' => 'baz'), 'arr' => array('boo', false, 5)), 'table_num' => array(1 => 5, 3 => 'foo', 786 => 674), 'array_nested' => array(1, array(2, array(3, array(4)))), 'table_nested' => array('i' => 1, 'n' => array('i' => 2, 'n' => array('i' => 3, 'n' => array('i' => 4))))), $r->read_table(true)->getNativeData()); }