Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 4313f31

Browse files
authored
Merge pull request #21 from keithbrink/analysis-d0DRwj
Apply fixes from StyleCI
2 parents 5297e17 + 73e30b2 commit 4313f31

35 files changed

+241
-241
lines changed

src/AmazonCore.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,12 @@ public function setMock($b = true, $files = null)
214214
*/
215215
protected function fetchMockFile($load = true)
216216
{
217-
if (!is_array($this->mockFiles) || !array_key_exists(0, $this->mockFiles)) {
217+
if (! is_array($this->mockFiles) || ! array_key_exists(0, $this->mockFiles)) {
218218
$this->log('Attempted to retrieve mock files, but no mock files present', 'Warning');
219219

220220
return false;
221221
}
222-
if (!array_key_exists($this->mockIndex, $this->mockFiles)) {
222+
if (! array_key_exists($this->mockIndex, $this->mockFiles)) {
223223
$this->log('End of Mock List, resetting to 0');
224224
$this->resetMock();
225225
}
@@ -267,7 +267,7 @@ protected function fetchMockFile($load = true)
267267
protected function resetMock($mute = false)
268268
{
269269
$this->mockIndex = 0;
270-
if (!$mute) {
270+
if (! $mute) {
271271
$this->log('Mock List index reset to 0');
272272
}
273273
}
@@ -294,16 +294,16 @@ protected function resetMock($mute = false)
294294
*/
295295
protected function fetchMockResponse()
296296
{
297-
if (!is_array($this->mockFiles) || !array_key_exists(0, $this->mockFiles)) {
297+
if (! is_array($this->mockFiles) || ! array_key_exists(0, $this->mockFiles)) {
298298
$this->log('Attempted to retrieve mock responses, but no mock responses present', 'Warning');
299299

300300
return false;
301301
}
302-
if (!array_key_exists($this->mockIndex, $this->mockFiles)) {
302+
if (! array_key_exists($this->mockIndex, $this->mockFiles)) {
303303
$this->log('End of Mock List, resetting to 0');
304304
$this->resetMock();
305305
}
306-
if (!is_numeric($this->mockFiles[$this->mockIndex])) {
306+
if (! is_numeric($this->mockFiles[$this->mockIndex])) {
307307
$this->log('fetchMockResponse only works with response code numbers', 'Warning');
308308

309309
return false;
@@ -368,7 +368,7 @@ protected function fetchMockResponse()
368368
*/
369369
protected function checkResponse($r)
370370
{
371-
if (!is_array($r) || !array_key_exists('code', $r)) {
371+
if (! is_array($r) || ! array_key_exists('code', $r)) {
372372
$this->log('No Response found', 'Warning');
373373

374374
return false;
@@ -397,7 +397,7 @@ protected function checkResponse($r)
397397
*/
398398
public function setConfig($config)
399399
{
400-
if (!$this->validateAndSetConfig($config)) {
400+
if (! $this->validateAndSetConfig($config)) {
401401
throw new \Exception('Configuration values not set correctly. See log for details.');
402402
}
403403
}
@@ -483,7 +483,7 @@ public function validateAndSetConfig($config)
483483
*/
484484
public function setThrottleStop($b = true)
485485
{
486-
$this->throttleStop = !empty($b);
486+
$this->throttleStop = ! empty($b);
487487
}
488488

489489
/**
@@ -565,7 +565,7 @@ public function getOptions()
565565
*/
566566
protected function genTime($time = false)
567567
{
568-
if (!$time) {
568+
if (! $time) {
569569
$time = time();
570570
} else {
571571
$time = strtotime($time);
@@ -644,7 +644,7 @@ protected function sendRequest($url, $param)
644644
*/
645645
public function getLastResponse($i = null)
646646
{
647-
if (!isset($i)) {
647+
if (! isset($i)) {
648648
$i = count($this->rawResponses) - 1;
649649
}
650650
if ($i >= 0 && isset($this->rawResponses[$i])) {
@@ -663,7 +663,7 @@ public function getLastResponse($i = null)
663663
*/
664664
public function getRawResponses()
665665
{
666-
if (!empty($this->rawResponses)) {
666+
if (! empty($this->rawResponses)) {
667667
return $this->rawResponses;
668668
} else {
669669
return false;
@@ -690,7 +690,7 @@ protected function sleep()
690690
*/
691691
protected function checkToken($xml)
692692
{
693-
if (!$xml) {
693+
if (! $xml) {
694694
return false;
695695
}
696696
if ($xml->NextToken) {
@@ -728,11 +728,11 @@ public function fetchURL($url, $param)
728728
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
729729
curl_setopt($ch, CURLOPT_HEADER, 1);
730730
curl_setopt($ch, CURLOPT_URL, $url);
731-
if (!empty($param)) {
732-
if (!empty($param['Header'])) {
731+
if (! empty($param)) {
732+
if (! empty($param['Header'])) {
733733
curl_setopt($ch, CURLOPT_HTTPHEADER, $param['Header']);
734734
}
735-
if (!empty($param['Post'])) {
735+
if (! empty($param['Post'])) {
736736
curl_setopt($ch, CURLOPT_POSTFIELDS, $param['Post']);
737737
}
738738
}
@@ -749,7 +749,7 @@ public function fetchURL($url, $param)
749749
$data = str_replace('HTTP/1.1 100 Continue', '', $data);
750750
}
751751
$data = preg_split("/\r\n\r\n/", $data, 2, PREG_SPLIT_NO_EMPTY);
752-
if (!empty($data)) {
752+
if (! empty($data)) {
753753
$return['head'] = (isset($data[0]) ? $data[0] : null);
754754
$return['body'] = (isset($data[1]) ? $data[1] : null);
755755
} else {
@@ -759,13 +759,13 @@ public function fetchURL($url, $param)
759759

760760
$matches = [];
761761
$data = preg_match("/HTTP\/[0-9.]+ ([0-9]+) (.+)\r\n/", $return['head'], $matches);
762-
if (!empty($matches)) {
762+
if (! empty($matches)) {
763763
$return['code'] = $matches[1];
764764
$return['answer'] = $matches[2];
765765
}
766766

767767
$data = preg_match("/meta http-equiv=.refresh. +content=.[0-9]*;url=([^'\"]*)/i", $return['body'], $matches);
768-
if (!empty($matches)) {
768+
if (! empty($matches)) {
769769
$return['location'] = $matches[1];
770770
$return['code'] = '301';
771771
}
@@ -865,7 +865,7 @@ protected function _calculateStringToSignV2(array $parameters)
865865
$data .= $endpoint['host'];
866866
$data .= "\n";
867867
$uri = array_key_exists('path', $endpoint) ? $endpoint['path'] : null;
868-
if (!isset($uri)) {
868+
if (! isset($uri)) {
869869
$uri = '/';
870870
}
871871
$uriencoded = implode('/', array_map([$this, '_urlencode'], explode('/', $uri)));

src/AmazonFeed.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public function setPurge($s = 'true')
232232
$this->options['PurgeAndReplace'] = 'true';
233233
$this->throttleTime = 86400;
234234
} else {
235-
if ($s == 'false' || (!$s && is_bool($s))) {
235+
if ($s == 'false' || (! $s && is_bool($s))) {
236236
$this->log('Purge mode deactivated.');
237237
$this->options['PurgeAndReplace'] = 'false';
238238
include $this->env;
@@ -257,12 +257,12 @@ public function setPurge($s = 'true')
257257
*/
258258
public function submitFeed()
259259
{
260-
if (!$this->feedContent) {
260+
if (! $this->feedContent) {
261261
$this->log("Feed's contents must be set in order to submit it!", 'Warning');
262262

263263
return false;
264264
}
265-
if (!array_key_exists('FeedType', $this->options)) {
265+
if (! array_key_exists('FeedType', $this->options)) {
266266
$this->log('Feed Type must be set in order to submit a feed!', 'Warning');
267267

268268
return false;
@@ -279,7 +279,7 @@ public function submitFeed()
279279
$headers = $this->genHeader();
280280
$response = $this->sendRequest("$url?$query", ['Header' => $headers, 'Post' => $this->feedContent]);
281281

282-
if (!$this->checkResponse($response)) {
282+
if (! $this->checkResponse($response)) {
283283
return false;
284284
}
285285

@@ -306,7 +306,7 @@ public function submitFeed()
306306
*/
307307
protected function parseXML($xml)
308308
{
309-
if (!$xml) {
309+
if (! $xml) {
310310
return false;
311311
}
312312

@@ -348,7 +348,7 @@ protected function genHeader()
348348
*/
349349
protected function checkResponse($r)
350350
{
351-
if (!is_array($r)) {
351+
if (! is_array($r)) {
352352
$this->log('No Response found', 'Warning');
353353

354354
return false;

src/AmazonFeedList.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public function fetchFeedSubmissions($r = true)
309309
} else {
310310
$response = $this->sendRequest($url, ['Post'=>$query]);
311311

312-
if (!$this->checkResponse($response)) {
312+
if (! $this->checkResponse($response)) {
313313
return false;
314314
}
315315

@@ -379,7 +379,7 @@ protected function prepareToken()
379379
*/
380380
protected function parseXML($xml)
381381
{
382-
if (!$xml) {
382+
if (! $xml) {
383383
return false;
384384
}
385385
foreach ($xml->children() as $key=>$x) {
@@ -423,7 +423,7 @@ public function countFeeds()
423423
} else {
424424
$response = $this->sendRequest($url, ['Post'=>$query]);
425425

426-
if (!$this->checkResponse($response)) {
426+
if (! $this->checkResponse($response)) {
427427
return false;
428428
}
429429

@@ -480,7 +480,7 @@ public function cancelFeeds()
480480
} else {
481481
$response = $this->sendRequest($url, ['Post'=>$query]);
482482

483-
if (!$this->checkResponse($response)) {
483+
if (! $this->checkResponse($response)) {
484484
return false;
485485
}
486486

src/AmazonFeedResult.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function setFeedId($n)
9898
*/
9999
public function fetchFeedResult()
100100
{
101-
if (!array_key_exists('FeedSubmissionId', $this->options)) {
101+
if (! array_key_exists('FeedSubmissionId', $this->options)) {
102102
$this->log('Feed Submission ID must be set in order to fetch it!', 'Warning');
103103

104104
return false;
@@ -113,7 +113,7 @@ public function fetchFeedResult()
113113
} else {
114114
$response = $this->sendRequest($url, ['Post' => $query]);
115115

116-
if (!$this->checkResponse($response)) {
116+
if (! $this->checkResponse($response)) {
117117
return false;
118118
}
119119

@@ -132,7 +132,7 @@ public function fetchFeedResult()
132132
*/
133133
public function saveFeed($path)
134134
{
135-
if (!isset($this->rawFeed)) {
135+
if (! isset($this->rawFeed)) {
136136
return false;
137137
}
138138

@@ -158,7 +158,7 @@ public function saveFeed($path)
158158
*/
159159
public function getRawFeed()
160160
{
161-
if (!isset($this->rawFeed)) {
161+
if (! isset($this->rawFeed)) {
162162
return false;
163163
}
164164

src/AmazonFulfillmentOrder.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct($s, $id = null, $mock = false, $m = null)
6868
*/
6969
public function setOrderId($s)
7070
{
71-
if ($s !== null && !is_int($s)) {
71+
if ($s !== null && ! is_int($s)) {
7272
$this->options['SellerFulfillmentOrderId'] = $s;
7373
} else {
7474
return false;
@@ -86,7 +86,7 @@ public function setOrderId($s)
8686
*/
8787
public function fetchOrder()
8888
{
89-
if (!array_key_exists('SellerFulfillmentOrderId', $this->options)) {
89+
if (! array_key_exists('SellerFulfillmentOrderId', $this->options)) {
9090
$this->log('Fulfillment Order ID must be set in order to fetch it!', 'Warning');
9191

9292
return false;
@@ -104,7 +104,7 @@ public function fetchOrder()
104104
} else {
105105
$response = $this->sendRequest($url, ['Post' => $query]);
106106

107-
if (!$this->checkResponse($response)) {
107+
if (! $this->checkResponse($response)) {
108108
return false;
109109
}
110110

@@ -125,16 +125,16 @@ public function fetchOrder()
125125
*/
126126
protected function parseXML($xml)
127127
{
128-
if (!$xml) {
128+
if (! $xml) {
129129
return false;
130130
}
131-
if (!$xml->FulfillmentOrder) {
131+
if (! $xml->FulfillmentOrder) {
132132
return false;
133133
}
134-
if (!$xml->FulfillmentOrderItem) {
134+
if (! $xml->FulfillmentOrderItem) {
135135
return false;
136136
}
137-
if (!$xml->FulfillmentShipment) {
137+
if (! $xml->FulfillmentShipment) {
138138
return false;
139139
}
140140
//Section 1: ShipmentOrder
@@ -270,7 +270,7 @@ protected function parseXML($xml)
270270
*/
271271
public function cancelOrder()
272272
{
273-
if (!array_key_exists('SellerFulfillmentOrderId', $this->options)) {
273+
if (! array_key_exists('SellerFulfillmentOrderId', $this->options)) {
274274
$this->log('Fulfillment Order ID must be set in order to cancel it!', 'Warning');
275275

276276
return false;
@@ -287,7 +287,7 @@ public function cancelOrder()
287287
} else {
288288
$response = $this->sendRequest($url, ['Post' => $query]);
289289
}
290-
if (!$this->checkResponse($response)) {
290+
if (! $this->checkResponse($response)) {
291291
return false;
292292
} else {
293293
$this->log('Successfully deleted Fulfillment Order '.$this->options['SellerFulfillmentOrderId']);

0 commit comments

Comments
 (0)