Permalink
Browse files

Merge pull request #42 from brikou/dev_psr

fixed coding standard to be psr compliant
  • Loading branch information...
videlalvaro committed Oct 12, 2012
2 parents a0c3be4 + 12172d2 commit 8a393d2e1c041b31186196cc67a17a880153ecea
Showing with 317 additions and 277 deletions.
  1. +46 −35 PhpAmqpLib/Channel/AMQPChannel.php
  2. +74 −76 PhpAmqpLib/Channel/AbstractChannel.php
  3. +22 −17 PhpAmqpLib/Connection/AMQPConnection.php
  4. +2 −1 PhpAmqpLib/Connection/AMQPSSLConnection.php
  5. +1 −1 PhpAmqpLib/Exception/AMQPChannelException.php
  6. +1 −1 PhpAmqpLib/Exception/AMQPConnectionException.php
  7. +1 −1 PhpAmqpLib/Exception/AMQPException.php
  8. +6 −7 PhpAmqpLib/Helper/MiscHelper.php
  9. +21 −1 PhpAmqpLib/Helper/Protocol/FrameBuilder.php
  10. +1 −1 PhpAmqpLib/Message/AMQPMessage.php
  11. +1 −1 PhpAmqpLib/Tests/Functional/Bug40Test.php
  12. +1 −1 PhpAmqpLib/Tests/Functional/FileTransferTest.php
  13. +1 −1 PhpAmqpLib/Tests/Functional/PublishConsumeTest.php
  14. +1 −2 PhpAmqpLib/Tests/Unit/Helper/Protocol/FrameBuilderTest.php
  15. +7 −9 PhpAmqpLib/Tests/Unit/Wire/AMQPWriterTest.php
  16. +1 −3 PhpAmqpLib/Tests/Unit/WireTest.php
  17. +1 −1 PhpAmqpLib/Wire/AMQPDecimal.php
  18. +21 −14 PhpAmqpLib/Wire/AMQPReader.php
  19. +29 −16 PhpAmqpLib/Wire/AMQPWriter.php
  20. +11 −13 PhpAmqpLib/Wire/BufferedInput.php
  21. +12 −11 PhpAmqpLib/Wire/GenericContent.php
  22. +4 −5 benchmark/consumer.php
  23. +3 −4 benchmark/file_consume.php
  24. +0 −2 benchmark/file_publish.php
  25. +0 −2 benchmark/producer.php
  26. +4 −4 demo/amqp_consumer.php
  27. +7 −7 demo/amqp_consumer_exclusive.php
  28. +5 −5 demo/amqp_consumer_fanout_1.php
  29. +5 −5 demo/amqp_consumer_fanout_2.php
  30. +4 −4 demo/amqp_consumer_non_blocking.php
  31. +16 −16 demo/amqp_ha_consumer.php
  32. +0 −1 demo/amqp_publisher.php
  33. +0 −1 demo/amqp_publisher_exclusive.php
  34. +0 −1 demo/amqp_publisher_fanout.php
  35. +1 −1 demo/basic_get.php
  36. +3 −3 demo/basic_return.php
  37. +1 −1 demo/config.php
  38. +3 −2 demo/ssl_connection.php
@@ -36,14 +36,14 @@ class AMQPChannel extends AbstractChannel
"90,31" => "tx_rollback_ok"
);
/**
- *
- * @var callable these parameters will be passed to function
+ *
+ * @var callable these parameters will be passed to function
* in case of basic_return:
- * param int $reply_code
- * param string $reply_text
- * param string $exchange
- * param string $routing_key
- * param AMQPMessage $msg
+ * param int $reply_code
+ * param string $reply_text
+ * param string $exchange
+ * param string $routing_key
+ * param AMQPMessage $msg
*/
protected $basic_return_callback = null;
@@ -122,6 +122,7 @@ public function close($reply_code=0,
);
$this->send_method_frame(array(20, 40), $args);
+
return $this->wait(array(
"20,41" // Channel.close_ok
));
@@ -157,6 +158,7 @@ public function flow($active)
{
$args = $this->frameBuilder->flow($active);
$this->send_method_frame(array(20, 20), $args);
+
return $this->wait(array(
"20,21" //Channel.flow_ok
));
@@ -187,6 +189,7 @@ protected function x_open($out_of_band="")
$args = $this->frameBuilder->xOpen($out_of_band);
$this->send_method_frame(array(20, 10), $args);
+
return $this->wait(array(
"20,11" //Channel.open_ok
));
@@ -211,6 +214,7 @@ public function access_request($realm, $exclusive=false,
$passive, $active,
$write, $read);
$this->send_method_frame(array(30, 10), $args);
+
return $this->wait(array(
"30,11" //Channel.access_request_ok
));
@@ -222,6 +226,7 @@ public function access_request($realm, $exclusive=false,
protected function access_request_ok($args)
{
$this->default_ticket = $args->read_short();
+
return $this->default_ticket;
}
@@ -452,6 +457,7 @@ public function basic_cancel($consumer_tag, $nowait=false)
{
$args = $this->frameBuilder->basicCancel($consumer_tag, $nowait);
$this->send_method_frame(array(60, 30), $args);
+
return $this->wait(array(
"60,31" // Channel.basic_cancel_ok
));
@@ -487,6 +493,7 @@ public function basic_consume($queue="", $consumer_tag="", $no_local=false,
}
$this->callbacks[$consumer_tag] = $callback;
+
return $consumer_tag;
}
@@ -538,6 +545,7 @@ public function basic_get($queue="", $no_ack=false, $ticket=null)
$args = $this->frameBuilder->basicGet($queue, $no_ack, $ticket);
$this->send_method_frame(array(60, 70), $args);
+
return $this->wait(array(
"60,71", //Channel.basic_get_ok
"60,72" // Channel.basic_get_empty
@@ -570,6 +578,7 @@ protected function basic_get_ok($args, $msg)
"routing_key" => $routing_key,
"message_count" => $message_count
);
+
return $msg;
}
@@ -593,20 +602,19 @@ public function basic_publish($msg, $exchange="", $routing_key="",
$msg->body);
}
-
/**
* specify quality of service
*/
public function basic_qos($prefetch_size, $prefetch_count, $a_global)
{
$args = $this->frameBuilder->basicQos($prefetch_size, $prefetch_count, $a_global);
$this->send_method_frame(array(60, 10), $args);
+
return $this->wait(array(
- "60,11" //Channel.basic_qos_ok
- ));
+ "60,11" //Channel.basic_qos_ok
+ ));
}
-
/**
* confirm the requested qos
*/
@@ -641,25 +649,26 @@ protected function basic_return($args, $msg)
$reply_text = $args->read_shortstr();
$exchange = $args->read_shortstr();
$routing_key = $args->read_shortstr();
-
- if( !is_null($this->basic_return_callback )){
- call_user_func_array($this->basic_return_callback, array(
- $reply_code,
- $reply_text,
- $exchange,
- $routing_key,
- $msg,
- ));
- } else if ($this->debug) {
- MiscHelper::debug_msg("Skipping unhandled basic_return message");
+
+ if ( !is_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) {
+ MiscHelper::debug_msg("Skipping unhandled basic_return message");
}
}
public function tx_commit()
{
$this->send_method_frame(array(90, 20));
+
return $this->wait(array(
- "90,21" //Channel.tx_commit_ok
- ));
+ "90,21" //Channel.tx_commit_ok
+ ));
}
/**
@@ -669,16 +678,16 @@ protected function tx_commit_ok($args)
{
}
-
/**
* abandon the current transaction
*/
public function tx_rollback()
{
$this->send_method_frame(array(90, 30));
+
return $this->wait(array(
- "90,31" //Channel.tx_rollback_ok
- ));
+ "90,31" //Channel.tx_rollback_ok
+ ));
}
/**
@@ -694,9 +703,10 @@ protected function tx_rollback_ok($args)
public function tx_select()
{
$this->send_method_frame(array(90, 10));
+
return $this->wait(array(
- "90,11" //Channel.tx_select_ok
- ));
+ "90,11" //Channel.tx_select_ok
+ ));
}
/**
@@ -717,13 +727,14 @@ protected function getTicket($ticket)
}
/**
* set callback for basic_return
- * @param callable $callback
+ * @param callable $callback
* @throws \InvalidArgumentException if $callback is not callable
*/
- public function set_return_listener($callback){
- if(!is_callable($callback))
- throw new \InvalidArgumentException('$callback should be callable.');
- $this->basic_return_callback = $callback;
+ public function set_return_listener($callback)
+ {
+ if (!is_callable($callback)) {
+ throw new \InvalidArgumentException("$callback should be callable.");
+ }
+ $this->basic_return_callback = $callback;
}
-
}
Oops, something went wrong.

0 comments on commit 8a393d2

Please sign in to comment.