@@ -25,12 +25,12 @@ |
||
| 25 | 25 | * @param callable $callback Callable that'll be invoked when a message is received |
| 26 | 26 | * @param int $timeout (optional) If specified, the process will block a max of $timeout seconds. Indefinitely if 0 |
| 27 | 27 | */ |
| 28 | - public function consume(callable $callback, $timeout=0) |
|
| 28 | + public function consume(callable $callback, $timeout = 0) |
|
| 29 | 29 | { |
| 30 | - while(true) { |
|
| 30 | + while (true) { |
|
| 31 | 31 | try { |
| 32 | 32 | $this->consumeOnce($callback, $timeout); |
| 33 | - } catch(TimeoutReaderException $e) { |
|
| 33 | + } catch (TimeoutReaderException $e) { |
|
| 34 | 34 | break; |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | * @throws ReaderException |
| 18 | 18 | * @return void |
| 19 | 19 | */ |
| 20 | - public function read(callable $callback, $timeout=0); |
|
| 20 | + public function read(callable $callback, $timeout = 0); |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Deletes all messages from the queue |
@@ -90,16 +90,16 @@ |
||
| 90 | 90 | * @throws ReaderException |
| 91 | 91 | * @throws TimeoutReaderException |
| 92 | 92 | */ |
| 93 | - public function read(callable $callback, $timeout=0) |
|
| 93 | + public function read(callable $callback, $timeout = 0) |
|
| 94 | 94 | { |
| 95 | 95 | $this->initialize(); |
| 96 | 96 | $this->messageHandler->setCallback($callback); |
| 97 | 97 | |
| 98 | 98 | try { |
| 99 | 99 | $this->consume($timeout); |
| 100 | - } catch(AMQPTimeoutException $e) { |
|
| 100 | + } catch (AMQPTimeoutException $e) { |
|
| 101 | 101 | throw new TimeoutReaderException("Timed out at $timeout seconds while reading.", 0, $e); |
| 102 | - } catch(\Exception $e) { |
|
| 102 | + } catch (\Exception $e) { |
|
| 103 | 103 | throw new ReaderException("Error occurred while reading", 0, $e); |
| 104 | 104 | } finally { |
| 105 | 105 | $this->channel->basic_cancel(''); |