@@ -70,7 +70,7 @@ |
||
70 | 70 | $connectionUsername, |
71 | 71 | $connectionPassword, |
72 | 72 | $connectionVhost, |
73 | - array $connectionContext = [], |
|
73 | + array $connectionContext = [ ], |
|
74 | 74 | $connectionInsist = null, |
75 | 75 | $connectionLoginMethod = null, |
76 | 76 | $connectionLocale = null, |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | * - 'channel' => AMQPChannel |
58 | 58 | * @param LoggerInterface $logger |
59 | 59 | */ |
60 | - public function __construct(IAmqpConfig $config, array $args = [], LoggerInterface $logger = null) |
|
60 | + public function __construct(IAmqpConfig $config, array $args = [ ], LoggerInterface $logger = null) |
|
61 | 61 | { |
62 | 62 | $this->logger = $logger ?: new NullLogger(); |
63 | 63 | $this->config = $config; |
64 | 64 | // injectable primarily for testing purposes |
65 | 65 | list($this->connection, $this->channel) = $this->checkTypes( |
66 | - isset($args['connection']) ? $args['connection'] : null, |
|
67 | - isset($args['channel']) ? $args['channel'] : null |
|
66 | + isset($args[ 'connection' ]) ? $args[ 'connection' ] : null, |
|
67 | + isset($args[ 'channel' ]) ? $args[ 'channel' ] : null |
|
68 | 68 | ); |
69 | 69 | $this->messageFactory = new Payload\OmnidirectionalMessageFactory(); |
70 | 70 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | protected function checkTypes(AbstractConnection $connection = null, AMQPChannel $channel = null) |
81 | 81 | { |
82 | - return [$connection, $channel]; |
|
82 | + return [ $connection, $channel ]; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | protected function declareQueue() |
132 | 132 | { |
133 | 133 | call_user_func_array( |
134 | - [$this->channel, 'queue_declare'], |
|
134 | + [ $this->channel, 'queue_declare' ], |
|
135 | 135 | $this->config->getQueueConfiguration() |
136 | 136 | ); |
137 | 137 | return $this; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | // ack every message received from the queue. |
196 | 196 | if ($message) { |
197 | 197 | // direct delivery_info array access recommended in PhpAmqpLib documentation |
198 | - $this->channel->basic_ack($message->delivery_info['delivery_tag']); |
|
198 | + $this->channel->basic_ack($message->delivery_info[ 'delivery_tag' ]); |
|
199 | 199 | } |
200 | 200 | return $message; |
201 | 201 | } |
@@ -185,7 +185,7 @@ |
||
185 | 185 | $vhost = urlencode($connectionVhost); |
186 | 186 | $this->endpoint = "amqp://{$connectionUsername}@{$connectionHostname}:{$connectionPort}/{$vhost}"; |
187 | 187 | |
188 | - $this->connectionConfig = new $this->connectionConfigTypes[$this->connectionType]( |
|
188 | + $this->connectionConfig = new $this->connectionConfigTypes[ $this->connectionType ]( |
|
189 | 189 | $connectionHostname, |
190 | 190 | $connectionPort, |
191 | 191 | $connectionUsername, |
@@ -187,8 +187,8 @@ |
||
187 | 187 | protected function getRequestUrlLogData() |
188 | 188 | { |
189 | 189 | $context = $this->getContext(); |
190 | - $logData = ['rom_request_url' => $this->config->getEndpoint()]; |
|
191 | - return $context ? $context->getMetaData(__CLASS__, $logData) : []; |
|
190 | + $logData = [ 'rom_request_url' => $this->config->getEndpoint() ]; |
|
191 | + return $context ? $context->getMetaData(__CLASS__, $logData) : [ ]; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | protected function logRequestUrl() |
@@ -57,7 +57,7 @@ |
||
57 | 57 | $storeId, |
58 | 58 | $service, |
59 | 59 | $operation, |
60 | - array $endpointParams = [], |
|
60 | + array $endpointParams = [ ], |
|
61 | 61 | LoggerInterface $logger = null |
62 | 62 | ) { |
63 | 63 | $this->logger = $logger ?: new NullLogger(); |
@@ -34,7 +34,7 @@ |
||
34 | 34 | /** @var int */ |
35 | 35 | protected $resultSuggestionCount; |
36 | 36 | /** @var string[] */ |
37 | - protected $validResultCodes = [self::RESULT_VALID]; |
|
37 | + protected $validResultCodes = [ self::RESULT_VALID ]; |
|
38 | 38 | /** @var string[] */ |
39 | 39 | protected $acceptResultCodes = [ |
40 | 40 | self::RESULT_VALID, |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | /** @var int */ |
38 | 38 | protected $currentKey = 0; |
39 | 39 | /** @var AMQPMessage[] */ |
40 | - protected $messages = []; |
|
40 | + protected $messages = [ ]; |
|
41 | 41 | /** @var IPayload[] */ |
42 | - protected $payloads = []; |
|
42 | + protected $payloads = [ ]; |
|
43 | 43 | /** @var LoggerInterface */ |
44 | 44 | protected $logger; |
45 | 45 | |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | if (!$this->valid()) { |
71 | 71 | return null; |
72 | 72 | } |
73 | - if (!isset($this->payloads[$this->currentKey])) { |
|
74 | - $this->payloads[$this->currentKey] = $this->processMessage($this->messages[$this->currentKey]); |
|
73 | + if (!isset($this->payloads[ $this->currentKey ])) { |
|
74 | + $this->payloads[ $this->currentKey ] = $this->processMessage($this->messages[ $this->currentKey ]); |
|
75 | 75 | } |
76 | - return $this->payloads[$this->currentKey]; |
|
76 | + return $this->payloads[ $this->currentKey ]; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | return false; |
89 | 89 | } |
90 | 90 | // if a payload already exists for the current key, we'll be able to return that |
91 | - if (isset($this->messages[$this->currentKey])) { |
|
91 | + if (isset($this->messages[ $this->currentKey ])) { |
|
92 | 92 | return true; |
93 | 93 | } |
94 | 94 | // if no payload exists for the current key yet, try to get the next one |
95 | 95 | $message = $this->api->getNextMessage(); |
96 | 96 | if ($message) { |
97 | - $this->messages[$this->currentKey] = $message; |
|
97 | + $this->messages[ $this->currentKey ] = $message; |
|
98 | 98 | return true; |
99 | 99 | } |
100 | 100 | // if no message exists and no new messages could be received, |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | /** @var LoggerInterface */ |
32 | 32 | protected $logger; |
33 | 33 | |
34 | - public function __construct(IConfig $config, IPayloadFactory $payloadFactory = null, array $messageMapping = [], LoggerInterface $logger = null) |
|
34 | + public function __construct(IConfig $config, IPayloadFactory $payloadFactory = null, array $messageMapping = [ ], LoggerInterface $logger = null) |
|
35 | 35 | { |
36 | 36 | $this->logger = $logger ?: new NullLogger(); |
37 | 37 | $this->config = $config; |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | public function messagePayload($type) |
55 | 55 | { |
56 | 56 | $key = $this->config->getConfigKey(); |
57 | - if (isset($this->messageTypeMap[$key])) { |
|
58 | - return $this->payloadFactory->buildPayload($this->messageTypeMap[$key][$type], null, null, $this->logger); |
|
57 | + if (isset($this->messageTypeMap[ $key ])) { |
|
58 | + return $this->payloadFactory->buildPayload($this->messageTypeMap[ $key ][ $type ], null, null, $this->logger); |
|
59 | 59 | } |
60 | 60 | throw new UnsupportedPayload("No payload found for '$key'"); |
61 | 61 | } |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | */ |
92 | 92 | protected function serializePhysicalAddress() |
93 | 93 | { |
94 | - $lines = []; |
|
94 | + $lines = [ ]; |
|
95 | 95 | $idx = 0; |
96 | - $addressLines = is_array($this->lines) ? $this->lines : []; |
|
96 | + $addressLines = is_array($this->lines) ? $this->lines : [ ]; |
|
97 | 97 | foreach ($addressLines as $line) { |
98 | 98 | $idx++; |
99 | - $lines[] = sprintf( |
|
99 | + $lines[ ] = sprintf( |
|
100 | 100 | '<Line%d>%s</Line%1$d>', |
101 | 101 | $idx, |
102 | 102 | $this->xmlEncode($line) |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | $trimmed = trim($lines); |
144 | 144 | $addressLines = preg_split("/\n/", $trimmed, null, PREG_SPLIT_NO_EMPTY); |
145 | 145 | |
146 | - $newLines = []; |
|
146 | + $newLines = [ ]; |
|
147 | 147 | foreach ($addressLines as $line) { |
148 | - $newLines[] = $this->cleanString($line, 70); |
|
148 | + $newLines[ ] = $this->cleanString($line, 70); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if (count($newLines) > 4) { |
152 | 152 | // concat lines beyond the four allowed down into the last line |
153 | - $newLines[3] = $this->cleanString(implode(' ', array_slice($newLines, 3)), 70); |
|
153 | + $newLines[ 3 ] = $this->cleanString(implode(' ', array_slice($newLines, 3)), 70); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | $finalLines = array_slice($newLines, 0, 4); |