@@ -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, |
@@ -17,85 +17,85 @@ |
||
17 | 17 | * Wrap include in a function to allow variables while protecting scope. |
18 | 18 | * @return array mapping of config keys to message payload types for bidirectional api operations |
19 | 19 | */ |
20 | -return call_user_func(function () { |
|
21 | - $map = []; |
|
22 | - $map['address/validate'] = [ |
|
20 | +return call_user_func(function() { |
|
21 | + $map = [ ]; |
|
22 | + $map[ 'address/validate' ] = [ |
|
23 | 23 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Address\ValidationRequest', |
24 | 24 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Address\ValidationReply', |
25 | 25 | ]; |
26 | - $map['orders/create'] = [ |
|
26 | + $map[ 'orders/create' ] = [ |
|
27 | 27 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Order\OrderCreateRequest', |
28 | 28 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Order\OrderCreateReply', |
29 | 29 | ]; |
30 | - $map['payments/creditcard/auth'] = [ |
|
30 | + $map[ 'payments/creditcard/auth' ] = [ |
|
31 | 31 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\CreditCardAuthRequest', |
32 | 32 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\CreditCardAuthReply', |
33 | 33 | ]; |
34 | - $map['payments/storedvalue/balance'] = [ |
|
34 | + $map[ 'payments/storedvalue/balance' ] = [ |
|
35 | 35 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\StoredValueBalanceRequest', |
36 | 36 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\StoredValueBalanceReply', |
37 | 37 | ]; |
38 | - $map['payments/storedvalue/redeem'] = [ |
|
38 | + $map[ 'payments/storedvalue/redeem' ] = [ |
|
39 | 39 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\StoredValueRedeemRequest', |
40 | 40 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\StoredValueRedeemReply', |
41 | 41 | ]; |
42 | - $map['payments/storedvalue/redeemvoid'] = [ |
|
42 | + $map[ 'payments/storedvalue/redeemvoid' ] = [ |
|
43 | 43 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\StoredValueRedeemVoidRequest', |
44 | 44 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\StoredValueRedeemVoidReply', |
45 | 45 | ]; |
46 | - $map['payments/paypal/setExpress'] = [ |
|
46 | + $map[ 'payments/paypal/setExpress' ] = [ |
|
47 | 47 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\PayPalSetExpressCheckoutRequest', |
48 | 48 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\PayPalSetExpressCheckoutReply', |
49 | 49 | ]; |
50 | - $map['payments/paypal/getExpress'] = [ |
|
50 | + $map[ 'payments/paypal/getExpress' ] = [ |
|
51 | 51 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\PayPalGetExpressCheckoutRequest', |
52 | 52 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\PayPalGetExpressCheckoutReply', |
53 | 53 | ]; |
54 | - $map['payments/paypal/doExpress'] = [ |
|
54 | + $map[ 'payments/paypal/doExpress' ] = [ |
|
55 | 55 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\PayPalDoExpressCheckoutRequest', |
56 | 56 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\PayPalDoExpressCheckoutReply', |
57 | 57 | ]; |
58 | - $map['payments/paypal/doAuth'] = [ |
|
58 | + $map[ 'payments/paypal/doAuth' ] = [ |
|
59 | 59 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\PayPalDoAuthorizationRequest', |
60 | 60 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\PayPalDoAuthorizationReply', |
61 | 61 | ]; |
62 | - $map['payments/paypal/void'] = [ |
|
62 | + $map[ 'payments/paypal/void' ] = [ |
|
63 | 63 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\PayPalDoVoidRequest', |
64 | 64 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\PayPalDoVoidReply', |
65 | 65 | ]; |
66 | - $map['taxes/quote'] = [ |
|
66 | + $map[ 'taxes/quote' ] = [ |
|
67 | 67 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\TaxDutyFee\TaxDutyFeeQuoteRequest', |
68 | 68 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\TaxDutyFee\TaxDutyFeeQuoteReply', |
69 | 69 | ]; |
70 | - $map['orders/cancel'] = [ |
|
70 | + $map[ 'orders/cancel' ] = [ |
|
71 | 71 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Order\OrderCancelRequest', |
72 | 72 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Order\OrderCancelResponse', |
73 | 73 | ]; |
74 | - $map['customers/orders/get'] = [ |
|
74 | + $map[ 'customers/orders/get' ] = [ |
|
75 | 75 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Customer\OrderSummaryRequest', |
76 | 76 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Customer\OrderSummaryResponse', |
77 | 77 | ]; |
78 | - $map['inventory/quantity/get'] = [ |
|
78 | + $map[ 'inventory/quantity/get' ] = [ |
|
79 | 79 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Inventory\QuantityRequest', |
80 | 80 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Inventory\QuantityReply', |
81 | 81 | ]; |
82 | - $map['inventory/details/get'] = [ |
|
82 | + $map[ 'inventory/details/get' ] = [ |
|
83 | 83 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Inventory\InventoryDetailsRequest', |
84 | 84 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Inventory\InventoryDetailsReply', |
85 | 85 | ]; |
86 | - $map['orders/get'] = [ |
|
86 | + $map[ 'orders/get' ] = [ |
|
87 | 87 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Order\Detail\OrderDetailRequest', |
88 | 88 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Order\Detail\OrderDetailResponse', |
89 | 89 | ]; |
90 | - $map['inventory/allocations/create'] = [ |
|
90 | + $map[ 'inventory/allocations/create' ] = [ |
|
91 | 91 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Inventory\AllocationRequest', |
92 | 92 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Inventory\AllocationReply', |
93 | 93 | ]; |
94 | - $map['inventory/allocations/delete'] = [ |
|
94 | + $map[ 'inventory/allocations/delete' ] = [ |
|
95 | 95 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Inventory\AllocationRollbackRequest', |
96 | 96 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Inventory\AllocationRollbackReply', |
97 | 97 | ]; |
98 | - $map['payments/tendertype/lookup'] = [ |
|
98 | + $map[ 'payments/tendertype/lookup' ] = [ |
|
99 | 99 | 'request' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\TenderType\LookupRequest', |
100 | 100 | 'reply' => '\eBayEnterprise\RetailOrderManagement\Payload\Payment\TenderType\LookupReply', |
101 | 101 | ]; |
@@ -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 | } |