@@ -26,14 +26,14 @@ |
||
| 26 | 26 | * @param callable $callback Callable that'll be invoked when a message is received |
| 27 | 27 | * @param int $timeout (optional) If specified, the process will block a max of $timeout seconds. Indefinitely if 0 |
| 28 | 28 | */ |
| 29 | - public function consume(callable $callback, $timeout=0) |
|
| 29 | + public function consume(callable $callback, $timeout = 0) |
|
| 30 | 30 | { |
| 31 | - while(true) { |
|
| 31 | + while (true) { |
|
| 32 | 32 | try { |
| 33 | 33 | $this->queueReader->read($callback, $timeout); |
| 34 | - } catch(TimeoutReaderException $e) { |
|
| 34 | + } catch (TimeoutReaderException $e) { |
|
| 35 | 35 | break; |
| 36 | - } catch(GracefulStopException $e) { |
|
| 36 | + } catch (GracefulStopException $e) { |
|
| 37 | 37 | break; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -97,20 +97,20 @@ discard block |
||
| 97 | 97 | * @throws TimeoutReaderException |
| 98 | 98 | * @throws GracefulStopException |
| 99 | 99 | */ |
| 100 | - public function read(callable $callback, $timeout=0) |
|
| 100 | + public function read(callable $callback, $timeout = 0) |
|
| 101 | 101 | { |
| 102 | 102 | $this->initialize(); |
| 103 | 103 | $this->messageHandler->setCallback($callback); |
| 104 | 104 | |
| 105 | 105 | try { |
| 106 | 106 | $this->consume($timeout); |
| 107 | - } catch(GracefulStopException $e) { |
|
| 107 | + } catch (GracefulStopException $e) { |
|
| 108 | 108 | $this->stopConsuming(); |
| 109 | 109 | throw new GracefulStopException("Graceful exception", 0, $e); |
| 110 | - } catch(AMQPTimeoutException $e) { |
|
| 110 | + } catch (AMQPTimeoutException $e) { |
|
| 111 | 111 | $this->stopConsuming(); |
| 112 | 112 | throw new TimeoutReaderException("Timed out at $timeout seconds while reading.", 0, $e); |
| 113 | - } catch(\Exception $e) { |
|
| 113 | + } catch (\Exception $e) { |
|
| 114 | 114 | $this->stopConsuming(); |
| 115 | 115 | throw new ReaderException("Error occurred while reading", 0, $e); |
| 116 | 116 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | protected function consume($timeout) |
| 170 | 170 | { |
| 171 | 171 | if ($this->consumerTag === '') { |
| 172 | - $this->logger->debug('Waiting for messages on queue:'.$this->queueConfig->getName()); |
|
| 172 | + $this->logger->debug('Waiting for messages on queue:' . $this->queueConfig->getName()); |
|
| 173 | 173 | $this->consumerTag = $this->channel->basic_consume( |
| 174 | 174 | $this->queueConfig->getName(), |
| 175 | 175 | '', |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | if ($this->consumerTag) { |
| 211 | 211 | try { |
| 212 | 212 | $this->channel->basic_cancel($this->consumerTag); |
| 213 | - } catch(\Exception $e) { |
|
| 213 | + } catch (\Exception $e) { |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | $this->consumerTag = ''; |