@@ -68,20 +68,20 @@ discard block |
||
| 68 | 68 | * @throws ReaderException |
| 69 | 69 | * @throws TimeoutReaderException |
| 70 | 70 | */ |
| 71 | - public function read(callable $callback, $timeout=0) |
|
| 71 | + public function read(callable $callback, $timeout = 0) |
|
| 72 | 72 | { |
| 73 | 73 | $this->messageHandler->setCallback($callback); |
| 74 | 74 | |
| 75 | 75 | try { |
| 76 | 76 | $this->consume($timeout); |
| 77 | - } catch(ParseMessageException $e){ |
|
| 77 | + } catch (ParseMessageException $e) { |
|
| 78 | 78 | throw $e; |
| 79 | - } catch(GracefulStopException $e) { |
|
| 79 | + } catch (GracefulStopException $e) { |
|
| 80 | 80 | $this->logger->info("Gracefully stopping the AWS queue reader", ["exception" => $e]); |
| 81 | 81 | throw $e; |
| 82 | - } catch(TimeoutReaderException $e) { |
|
| 82 | + } catch (TimeoutReaderException $e) { |
|
| 83 | 83 | throw $e; |
| 84 | - } catch(\Exception $e) { |
|
| 84 | + } catch (\Exception $e) { |
|
| 85 | 85 | throw new ReaderException("Error occurred while reading", 0, $e); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $messages = isset($result['Messages']) ? $result['Messages'] : []; |
| 120 | 120 | foreach ($messages as $message) { |
| 121 | 121 | $response = $this->messageHandler->handleMessage($message); |
| 122 | - if(is_null($response) || !is_bool($response) || $response) { |
|
| 122 | + if (is_null($response) || !is_bool($response) || $response) { |
|
| 123 | 123 | $this->sqs->deleteMessage(['QueueUrl' => $this->queueUrl, 'ReceiptHandle' => $message['ReceiptHandle']]); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | throw new ReaderException("Handling a message with no callback set"); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - try{ |
|
| 45 | + try { |
|
| 46 | 46 | |
| 47 | 47 | if (!isset($message['Body'])) { |
| 48 | 48 | throw new InvalidJSONMessageException('Undefined index key Body: ' . print_r($message, true)); |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | return call_user_func($this->callback, $this->jsonMessageFactory->create($body['Message'])); |
| 58 | 58 | |
| 59 | - } catch(InvalidJSONMessageException $e) { |
|
| 60 | - throw new ParseMessageException(json_encode($message),0, $e); |
|
| 59 | + } catch (InvalidJSONMessageException $e) { |
|
| 60 | + throw new ParseMessageException(json_encode($message), 0, $e); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
@@ -42,10 +42,10 @@ |
||
| 42 | 42 | try { |
| 43 | 43 | $task = $this->jsonMessageFactory->create($message->body); |
| 44 | 44 | $response = call_user_func($this->callback, $task); |
| 45 | - if(is_null($response) || !is_bool($response) || $response) { |
|
| 45 | + if (is_null($response) || !is_bool($response) || $response) { |
|
| 46 | 46 | $message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']); |
| 47 | 47 | } |
| 48 | - } catch(InvalidJSONMessageException $e) { |
|
| 48 | + } catch (InvalidJSONMessageException $e) { |
|
| 49 | 49 | throw new ParseMessageException(json_encode($message->getBody()), 0, $e); |
| 50 | 50 | } |
| 51 | 51 | } |