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

Commit e77518a

Browse files
authored
Merge pull request #6 from keithbrink/analysis-qBeyOV
Apply fixes from StyleCI
2 parents 782fa0e + 155d361 commit e77518a

File tree

1 file changed

+63
-34
lines changed

1 file changed

+63
-34
lines changed

src/AmazonPrepInfo.php

Lines changed: 63 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ class AmazonPrepInfo extends AmazonInboundCore implements Iterator
3535
protected $i = 0;
3636

3737
/**
38-
* Sets the seller SKU(s). (Required*)
38+
* Sets the seller SKU(s). (Required*).
3939
*
4040
* This method sets the list of seller SKUs to be sent in the next request.
4141
* If this parameter is set, ASINs cannot be set.
42+
*
4243
* @param array|string $s <p>A list of Seller SKUs, or a single SKU string. (max: 20)</p>
43-
* @return boolean <b>FALSE</b> if improper input
44+
*
45+
* @return bool <b>FALSE</b> if improper input
4446
*/
4547
public function setSkus($s)
4648
{
@@ -69,19 +71,21 @@ public function setSkus($s)
6971
private function resetSkus()
7072
{
7173
foreach ($this->options as $op=>$junk) {
72-
if (preg_match("#SellerSKUList#", $op)) {
74+
if (preg_match('#SellerSKUList#', $op)) {
7375
unset($this->options[$op]);
7476
}
7577
}
7678
}
7779

7880
/**
79-
* Sets the ASIN(s). (Required*)
81+
* Sets the ASIN(s). (Required*).
8082
*
8183
* This method sets the list of ASINs to be sent in the next request.
8284
* If this parameter is set, Seller SKUs cannot be set.
85+
*
8386
* @param array|string $s <p>A list of ASINs, or a single ASIN string. (max: 20)</p>
84-
* @return boolean <b>FALSE</b> if improper input
87+
*
88+
* @return bool <b>FALSE</b> if improper input
8589
*/
8690
public function setAsins($s)
8791
{
@@ -110,7 +114,7 @@ public function setAsins($s)
110114
private function resetAsins()
111115
{
112116
foreach ($this->options as $op=>$junk) {
113-
if (preg_match("#ASINList#", $op)) {
117+
if (preg_match('#ASINList#', $op)) {
114118
unset($this->options[$op]);
115119
}
116120
}
@@ -126,13 +130,15 @@ private function resetAsins()
126130
* Other methods are available for fetching specific values from the list.
127131
* A list of items that were deemed invalid can also be retrieved using
128132
* <i>getInvalidItemList</i>.
129-
* @return boolean <b>FALSE</b> if something goes wrong
133+
*
134+
* @return bool <b>FALSE</b> if something goes wrong
130135
*/
131136
public function fetchPrepInstructions()
132137
{
133138
if (!array_key_exists('SellerSKUList.Id.1', $this->options) &&
134139
!array_key_exists('ASINList.Id.1', $this->options)) {
135-
$this->log("Product IDs must be set in order to get prep instructions!", 'Warning');
140+
$this->log('Product IDs must be set in order to get prep instructions!', 'Warning');
141+
136142
return false;
137143
}
138144

@@ -181,8 +187,10 @@ protected function preparePrep()
181187
* Parses XML response into array.
182188
*
183189
* This is what reads the response XML and converts it into an array.
190+
*
184191
* @param SimpleXMLElement $xml <p>The XML response from Amazon.</p>
185-
* @return boolean <b>FALSE</b> if no XML data is found
192+
*
193+
* @return bool <b>FALSE</b> if no XML data is found
186194
*/
187195
protected function parseXml($xml)
188196
{
@@ -202,20 +210,20 @@ protected function parseXml($xml)
202210
foreach ($list->children() as $x) {
203211
$temp = [];
204212
if (isset($x->SellerSKU)) {
205-
$temp['SellerSKU'] = (string)$x->SellerSKU;
213+
$temp['SellerSKU'] = (string) $x->SellerSKU;
206214
}
207-
$temp['ASIN'] = (string)$x->ASIN;
208-
$temp['BarcodeInstruction'] = (string)$x->BarcodeInstruction;
209-
$temp['PrepGuidance'] = (string)$x->PrepGuidance;
215+
$temp['ASIN'] = (string) $x->ASIN;
216+
$temp['BarcodeInstruction'] = (string) $x->BarcodeInstruction;
217+
$temp['PrepGuidance'] = (string) $x->PrepGuidance;
210218
foreach ($x->PrepInstructionList->children() as $z) {
211-
$temp['PrepInstructionList'][] = (string)$z;
219+
$temp['PrepInstructionList'][] = (string) $z;
212220
}
213221
if (isset($x->AmazonPrepFeesDetailsList)) {
214222
foreach ($x->AmazonPrepFeesDetailsList->children() as $z) {
215223
$fee = [];
216-
$fee['PrepInstruction'] = (string)$z->PrepInstruction;
217-
$fee['Amount']['Value'] = (string)$z->Amount->Value;
218-
$fee['Amount']['CurrencyCode'] = (string)$z->Amount->CurrencyCode;
224+
$fee['PrepInstruction'] = (string) $z->PrepInstruction;
225+
$fee['Amount']['Value'] = (string) $z->Amount->Value;
226+
$fee['Amount']['CurrencyCode'] = (string) $z->Amount->CurrencyCode;
219227
$temp['AmazonPrepFees'][] = $fee;
220228
}
221229
}
@@ -234,12 +242,12 @@ protected function parseXml($xml)
234242
if ($invList) {
235243
foreach ($invList->children() as $x) {
236244
$temp = [];
237-
$temp['ErrorReason'] = (string)$x->ErrorReason;
245+
$temp['ErrorReason'] = (string) $x->ErrorReason;
238246
if (isset($x->SellerSKU)) {
239-
$temp['SellerSKU'] = (string)$x->SellerSKU;
247+
$temp['SellerSKU'] = (string) $x->SellerSKU;
240248
}
241249
if (isset($x->ASIN)) {
242-
$temp['ASIN'] = (string)$x->ASIN;
250+
$temp['ASIN'] = (string) $x->ASIN;
243251
}
244252
$this->invalidList[] = $temp;
245253
}
@@ -252,8 +260,10 @@ protected function parseXml($xml)
252260
* Prep instructions will only include this data if SKUs were sent when
253261
* retrieving the list of prep instructions.
254262
* This method will return <b>FALSE</b> if the list has not yet been filled.
263+
*
255264
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
256-
* @return string|boolean single value, or <b>FALSE</b> if Non-numeric index
265+
*
266+
* @return string|bool single value, or <b>FALSE</b> if Non-numeric index
257267
*/
258268
public function getSku($i = 0)
259269
{
@@ -268,8 +278,10 @@ public function getSku($i = 0)
268278
* Returns the ASIN for the specified item preperation instruction.
269279
*
270280
* This method will return <b>FALSE</b> if the list has not yet been filled.
281+
*
271282
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
272-
* @return string|boolean single value, or <b>FALSE</b> if Non-numeric index
283+
*
284+
* @return string|bool single value, or <b>FALSE</b> if Non-numeric index
273285
*/
274286
public function getAsin($i = 0)
275287
{
@@ -285,8 +297,10 @@ public function getAsin($i = 0)
285297
*
286298
* Possible values are "RequiresFNSKULabel" and "CanUseOriginalBarcode".
287299
* This method will return <b>FALSE</b> if the list has not yet been filled.
300+
*
288301
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
289-
* @return string|boolean single value, or <b>FALSE</b> if Non-numeric index
302+
*
303+
* @return string|bool single value, or <b>FALSE</b> if Non-numeric index
290304
*/
291305
public function getBarcodeInstruction($i = 0)
292306
{
@@ -303,8 +317,10 @@ public function getBarcodeInstruction($i = 0)
303317
* Possible values are "ConsultHelpDocuments", "NoAdditionalPrepRequired",
304318
* and "SeePrepInstructionsList".
305319
* This method will return <b>FALSE</b> if the list has not yet been filled.
320+
*
306321
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
307-
* @return string|boolean single value, or <b>FALSE</b> if Non-numeric index
322+
*
323+
* @return string|bool single value, or <b>FALSE</b> if Non-numeric index
308324
*/
309325
public function getPrepGuidance($i = 0)
310326
{
@@ -321,8 +337,10 @@ public function getPrepGuidance($i = 0)
321337
* Possible values are "Polybagging", "BubbleWrapping", "Taping", "BlackShrinkWrapping",
322338
* "Labeling", and "HangGarment".
323339
* This method will return <b>FALSE</b> if the list has not yet been filled.
340+
*
324341
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
325-
* @return array|boolean simple array, or <b>FALSE</b> if Non-numeric index
342+
*
343+
* @return array|bool simple array, or <b>FALSE</b> if Non-numeric index
326344
*/
327345
public function getPrepInstructions($i = 0)
328346
{
@@ -348,8 +366,11 @@ public function getPrepInstructions($i = 0)
348366
* Prep instructions will only include this data if SKUs were sent when
349367
* retrieving the list of prep instructions.
350368
* This method will return <b>FALSE</b> if the list has not yet been filled.
369+
*
351370
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
352-
* @return array|boolean multi-dimensional array, or <b>FALSE</b> if Non-numeric index
371+
*
372+
* @return array|bool multi-dimensional array, or <b>FALSE</b> if Non-numeric index
373+
*
353374
* @see getPrepInstructions
354375
*/
355376
public function getAmazonPrepFees($i = 0)
@@ -374,8 +395,11 @@ public function getAmazonPrepFees($i = 0)
374395
* <li><b>PrepInstructionList</b> (see <i>getPrepInstructions</i> for details)</li>
375396
* <li><b>AmazonPrepFees</b> (see <i>getAmazonPrepFees</i> for details)</li>
376397
* </ul>
398+
*
377399
* @param int $i [optional] <p>List index of the instruction to return. Defaults to NULL.</p>
378-
* @return array|boolean multi-dimensional array, or <b>FALSE</b> if list not filled yet
400+
*
401+
* @return array|bool multi-dimensional array, or <b>FALSE</b> if list not filled yet
402+
*
379403
* @see getPrepInstructionList
380404
* @see getAmazonPrepFees
381405
*/
@@ -400,8 +424,10 @@ public function getPrepList($i = null)
400424
* <li><b>SellerSKU</b> or <b>ASIN</b></li>
401425
* <li><b>ErrorReason</b></li>
402426
* </ul>
427+
*
403428
* @param int $i [optional] <p>List index of the item to return. Defaults to NULL.</p>
404-
* @return array|boolean multi-dimensional array, or <b>FALSE</b> if list not filled yet
429+
*
430+
* @return array|bool multi-dimensional array, or <b>FALSE</b> if list not filled yet
405431
*/
406432
public function getInvalidItemList($i = null)
407433
{
@@ -416,7 +442,8 @@ public function getInvalidItemList($i = null)
416442
}
417443

418444
/**
419-
* Iterator function
445+
* Iterator function.
446+
*
420447
* @return array
421448
*/
422449
public function current()
@@ -425,15 +452,16 @@ public function current()
425452
}
426453

427454
/**
428-
* Iterator function
455+
* Iterator function.
429456
*/
430457
public function rewind()
431458
{
432459
$this->i = 0;
433460
}
434461

435462
/**
436-
* Iterator function
463+
* Iterator function.
464+
*
437465
* @return int
438466
*/
439467
public function key()
@@ -442,16 +470,17 @@ public function key()
442470
}
443471

444472
/**
445-
* Iterator function
473+
* Iterator function.
446474
*/
447475
public function next()
448476
{
449477
$this->i++;
450478
}
451479

452480
/**
453-
* Iterator function
454-
* @return boolean
481+
* Iterator function.
482+
*
483+
* @return bool
455484
*/
456485
public function valid()
457486
{

0 commit comments

Comments
 (0)