@@ -44,18 +44,18 @@ discard block |
||
| 44 | 44 | return $this; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function start($timeout=0) |
|
| 47 | + public function start($timeout = 0) |
|
| 48 | 48 | { |
| 49 | - if(!isset($this->subscriptors[0])) { |
|
| 49 | + if (!isset($this->subscriptors[0])) { |
|
| 50 | 50 | throw new DomainEventException('You must add at least 1 EventSubscriptor in order to publish start reading from queue.'); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - while(true) { |
|
| 53 | + while (true) { |
|
| 54 | 54 | try { |
| 55 | 55 | $this->queueReader->read(array($this, 'notify'), $timeout); |
| 56 | - } catch(TimeoutReaderException $e) { |
|
| 56 | + } catch (TimeoutReaderException $e) { |
|
| 57 | 57 | break; |
| 58 | - } catch(GracefulStopException $e) { |
|
| 58 | + } catch (GracefulStopException $e) { |
|
| 59 | 59 | break; |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | public function notify(DomainEvent $domainEvent) |
| 68 | 68 | { |
| 69 | 69 | $this->logger->debug('Domain Event received, notifying subscribers'); |
| 70 | - foreach($this->subscriptors as $subscriptor) { |
|
| 71 | - if($subscriptor->isSubscribed($domainEvent)) { |
|
| 70 | + foreach ($this->subscriptors as $subscriptor) { |
|
| 71 | + if ($subscriptor->isSubscribed($domainEvent)) { |
|
| 72 | 72 | $subscriptor->notify($domainEvent); |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -65,18 +65,18 @@ |
||
| 65 | 65 | * @throws TimeoutReaderException |
| 66 | 66 | * @throws ReaderException |
| 67 | 67 | */ |
| 68 | - public function read(callable $callback, $timeout=0) |
|
| 68 | + public function read(callable $callback, $timeout = 0) |
|
| 69 | 69 | { |
| 70 | 70 | $this->messageHandler->setCallback($callback); |
| 71 | 71 | |
| 72 | 72 | try { |
| 73 | 73 | $this->consume($timeout); |
| 74 | - } catch(GracefulStopException $e) { |
|
| 74 | + } catch (GracefulStopException $e) { |
|
| 75 | 75 | $this->logger->info("Gracefully stopping the AWS queue reader", ["exception" => $e]); |
| 76 | 76 | throw $e; |
| 77 | - } catch(TimeoutReaderException $e) { |
|
| 77 | + } catch (TimeoutReaderException $e) { |
|
| 78 | 78 | throw $e; |
| 79 | - } catch(\Exception $e) { |
|
| 79 | + } catch (\Exception $e) { |
|
| 80 | 80 | throw new ReaderException("Error occurred while reading", 0, $e); |
| 81 | 81 | } |
| 82 | 82 | } |