@@ -43,16 +43,16 @@ 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 | - if(!isset($this->subscriptors[0])) { |
|
48 | + if (!isset($this->subscriptors[0])) { |
|
49 | 49 | throw new DomainEventException('You must add at least 1 EventSubscriptor in order to publish start reading from queue.'); |
50 | 50 | } |
51 | 51 | |
52 | - while(true) { |
|
52 | + while (true) { |
|
53 | 53 | try { |
54 | 54 | $this->queueReader->read(array($this, 'notify'), $timeout); |
55 | - } catch(TimeoutReaderException $e) { |
|
55 | + } catch (TimeoutReaderException $e) { |
|
56 | 56 | break; |
57 | 57 | } |
58 | 58 | } |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | public function notify(DomainEvent $domainEvent) |
65 | 65 | { |
66 | 66 | $this->logger->debug('Domain Event received, notifying subscribers'); |
67 | - foreach($this->subscriptors as $subscriptor) { |
|
68 | - if($subscriptor->isSubscribed($domainEvent)) { |
|
67 | + foreach ($this->subscriptors as $subscriptor) { |
|
68 | + if ($subscriptor->isSubscribed($domainEvent)) { |
|
69 | 69 | $subscriptor->notify($domainEvent); |
70 | 70 | } |
71 | 71 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | 'TopicArn' => $this->topicArn, |
64 | 64 | 'Message' => json_encode($message), |
65 | 65 | ]); |
66 | - } catch(\Exception $e) { |
|
66 | + } catch (\Exception $e) { |
|
67 | 67 | $this->logger->error('Error writing messages', ['exception' => $e]); |
68 | 68 | throw new WriterException($e->getMessage(), $e->getCode()); |
69 | 69 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | public static function create($region) |
36 | 36 | { |
37 | - $sqs = SqsClient::factory(['region' => $region, 'version' => '2012-11-05',]); |
|
37 | + $sqs = SqsClient::factory(['region' => $region, 'version' => '2012-11-05', ]); |
|
38 | 38 | $sns = SnsClient::factory(['region' => $region, 'version' => '2010-03-31']); |
39 | 39 | |
40 | 40 | return new self($sqs, $sns); |
@@ -64,17 +64,17 @@ |
||
64 | 64 | * @throws TimeoutReaderException |
65 | 65 | * @throws ReaderException |
66 | 66 | */ |
67 | - public function read(callable $callback, $timeout=0) |
|
67 | + public function read(callable $callback, $timeout = 0) |
|
68 | 68 | { |
69 | 69 | $this->messageHandler->setCallback($callback); |
70 | 70 | |
71 | 71 | try { |
72 | 72 | $this->consume($timeout); |
73 | - } catch(GracefulStopException $e) { |
|
73 | + } catch (GracefulStopException $e) { |
|
74 | 74 | $this->logger->info("Gracefully stopping the AWS queue reader", ["exception" => $e]); |
75 | - } catch(TimeoutReaderException $e) { |
|
75 | + } catch (TimeoutReaderException $e) { |
|
76 | 76 | throw $e; |
77 | - } catch(\Exception $e) { |
|
77 | + } catch (\Exception $e) { |
|
78 | 78 | throw new ReaderException("Error occurred while reading", 0, $e); |
79 | 79 | } |
80 | 80 | } |