@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @param int $timeout |
| 95 | 95 | * @throws ReaderException |
| 96 | 96 | */ |
| 97 | - public function read(callable $callback, $timeout=0) |
|
| 97 | + public function read(callable $callback, $timeout = 0) |
|
| 98 | 98 | { |
| 99 | 99 | $this->initialize(); |
| 100 | 100 | $this->messageHandler->setCallback($callback); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | protected function initialize() |
| 108 | 108 | { |
| 109 | - if($this->channel) { |
|
| 109 | + if ($this->channel) { |
|
| 110 | 110 | return; |
| 111 | 111 | } |
| 112 | 112 | $this->logger->info('Connecting to RabbitMQ'); |
@@ -42,15 +42,15 @@ discard block |
||
| 42 | 42 | return $this; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function start($timeout=0) |
|
| 45 | + public function start($timeout = 0) |
|
| 46 | 46 | { |
| 47 | - if(!isset($this->subscriptors[0])) { |
|
| 47 | + if (!isset($this->subscriptors[0])) { |
|
| 48 | 48 | throw new DomainEventException('You must add at least 1 EventSubscriptor in order to publish start reading from queue.'); |
| 49 | 49 | } |
| 50 | - while(true) { |
|
| 50 | + while (true) { |
|
| 51 | 51 | try { |
| 52 | 52 | $this->queueReader->read(array($this, 'notify'), $timeout); |
| 53 | - } catch(\Exception $e) { |
|
| 53 | + } catch (\Exception $e) { |
|
| 54 | 54 | break; |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | public function notify(DomainEvent $domainEvent) |
| 63 | 63 | { |
| 64 | 64 | $this->logger->info('Domain Event received, notifying subscribers'); |
| 65 | - foreach($this->subscriptors as $subscriptor) { |
|
| 66 | - if($subscriptor->isSubscribed($domainEvent)) { |
|
| 65 | + foreach ($this->subscriptors as $subscriptor) { |
|
| 66 | + if ($subscriptor->isSubscribed($domainEvent)) { |
|
| 67 | 67 | $subscriptor->notify($domainEvent); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -17,5 +17,5 @@ |
||
| 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 | \ No newline at end of file |
@@ -19,12 +19,12 @@ |
||
| 19 | 19 | $this->queueReader = $queueReader; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function consume(callable $callback, $timeout=0) |
|
| 22 | + public function consume(callable $callback, $timeout = 0) |
|
| 23 | 23 | { |
| 24 | - while(true) { |
|
| 24 | + while (true) { |
|
| 25 | 25 | try { |
| 26 | 26 | $this->queueReader->read($callback, $timeout); |
| 27 | - } catch(\Exception $e) { |
|
| 27 | + } catch (\Exception $e) { |
|
| 28 | 28 | break; |
| 29 | 29 | } |
| 30 | 30 | } |