@@ -20,12 +20,12 @@ |
||
20 | 20 | $this->queueReader = $queueReader; |
21 | 21 | } |
22 | 22 | |
23 | - public function consume(callable $callback, $timeout=0) |
|
23 | + public function consume(callable $callback, $timeout = 0) |
|
24 | 24 | { |
25 | - while(true) { |
|
25 | + while (true) { |
|
26 | 26 | try { |
27 | 27 | $this->consumeOnce($callback, $timeout); |
28 | - } catch(TimeoutReaderException $e) { |
|
28 | + } catch (TimeoutReaderException $e) { |
|
29 | 29 | break; |
30 | 30 | } |
31 | 31 | } |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | return $this; |
44 | 44 | } |
45 | 45 | |
46 | - public function start($timeout=0) |
|
46 | + public function start($timeout = 0) |
|
47 | 47 | { |
48 | - while(true) { |
|
48 | + while (true) { |
|
49 | 49 | try { |
50 | 50 | $this->processOne($timeout); |
51 | - } catch(TimeoutReaderException $e) { |
|
51 | + } catch (TimeoutReaderException $e) { |
|
52 | 52 | break; |
53 | 53 | } |
54 | 54 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | public function processOne($timeout) |
58 | 58 | { |
59 | - if(!isset($this->subscriptors[0])) { |
|
59 | + if (!isset($this->subscriptors[0])) { |
|
60 | 60 | throw new DomainEventException('You must add at least 1 EventSubscriptor in order to publish start reading from queue.'); |
61 | 61 | } |
62 | 62 | $this->queueReader->read(array($this, 'notify'), $timeout); |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | public function notify(DomainEvent $domainEvent) |
69 | 69 | { |
70 | 70 | $this->logger->info('Domain Event received, notifying subscribers'); |
71 | - foreach($this->subscriptors as $subscriptor) { |
|
72 | - if($subscriptor->isSubscribed($domainEvent)) { |
|
71 | + foreach ($this->subscriptors as $subscriptor) { |
|
72 | + if ($subscriptor->isSubscribed($domainEvent)) { |
|
73 | 73 | $subscriptor->notify($domainEvent); |
74 | 74 | } |
75 | 75 | } |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | * @throws ReaderException |
97 | 97 | * @throws TimeoutReaderException |
98 | 98 | */ |
99 | - public function read(callable $callback, $timeout=0) |
|
99 | + public function read(callable $callback, $timeout = 0) |
|
100 | 100 | { |
101 | 101 | $this->initialize(); |
102 | 102 | $this->messageHandler->setCallback($callback); |
103 | 103 | try { |
104 | 104 | $this->channel->wait(null, false, $timeout); |
105 | - } catch(\Exception $e) { |
|
105 | + } catch (\Exception $e) { |
|
106 | 106 | throw new TimeoutReaderException(); |
107 | 107 | } |
108 | 108 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | protected function initialize() |
114 | 114 | { |
115 | - if($this->channel) { |
|
115 | + if ($this->channel) { |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | $this->logger->info('Connecting to RabbitMQ'); |