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

Commit 812c73e

Browse files
authored
Merge pull request #30 from keithbrink/analysis-YjWLko
Apply fixes from StyleCI
2 parents 95d43b2 + dbe1169 commit 812c73e

13 files changed

+620
-480
lines changed

src/AmazonFinancialEventList.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -442,20 +442,20 @@ protected function parseXml($xml)
442442
}
443443
}
444444
if (isset($xml->SAFETReimbursementEventList)) {
445-
foreach($xml->SAFETReimbursementEventList->children() as $x) {
446-
$temp = array();
447-
$temp['PostedDate'] = (string)$x->PostedDate;
448-
$temp['SAFETClaimId'] = (string)$x->SAFETClaimId;
449-
$temp['Amount'] = (string)$x->ReimbursedAmount->CurrencyAmount;
450-
$temp['CurrencyCode'] = (string)$x->ReimbursedAmount->CurrencyCode;
451-
$temp['SAFETReimbursementItemList'] = array();
445+
foreach ($xml->SAFETReimbursementEventList->children() as $x) {
446+
$temp = [];
447+
$temp['PostedDate'] = (string) $x->PostedDate;
448+
$temp['SAFETClaimId'] = (string) $x->SAFETClaimId;
449+
$temp['Amount'] = (string) $x->ReimbursedAmount->CurrencyAmount;
450+
$temp['CurrencyCode'] = (string) $x->ReimbursedAmount->CurrencyCode;
451+
$temp['SAFETReimbursementItemList'] = [];
452452
if (isset($x->SAFETReimbursementItemList)) {
453-
foreach($x->SAFETReimbursementItemList->children() as $y) {
454-
if (!isset($y->ItemChargeList)) {
453+
foreach ($x->SAFETReimbursementItemList->children() as $y) {
454+
if (! isset($y->ItemChargeList)) {
455455
continue;
456456
}
457-
$ztemp = array();
458-
foreach($y->ItemChargeList->children() as $z) {
457+
$ztemp = [];
458+
foreach ($y->ItemChargeList->children() as $z) {
459459
$ztemp['ItemChargeList'][] = $this->parseCharge($z);
460460
}
461461
$temp['SAFETReimbursementItemList'][] = $ztemp;
@@ -1070,10 +1070,11 @@ public function getAdjustmentEvents()
10701070
* </ul>
10711071
* </ul>
10721072
* </ul>
1073-
* @return array|boolean multi-dimensional array, or <b>FALSE</b> if list not filled yet
1073+
* @return array|bool multi-dimensional array, or <b>FALSE</b> if list not filled yet
10741074
*/
1075-
public function getSafetEvents(){
1076-
if (isset($this->list['SAFET'])){
1075+
public function getSafetEvents()
1076+
{
1077+
if (isset($this->list['SAFET'])) {
10771078
return $this->list['SAFET'];
10781079
} else {
10791080
return false;

src/AmazonRecommendationCore.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace KeithBrink\AmazonMws;
44

5-
use Exception;
6-
75
/**
86
* Copyright 2013 CPI Group, LLC.
97
*

src/AmazonSubscriptionCore.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace KeithBrink\AmazonMws;
44

5-
use Exception;
6-
75
/**
86
* Copyright 2013 CPI Group, LLC.
97
*

tests/classes/AmazonFinancialGroupListTest.php

Lines changed: 60 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
use KeithBrink\AmazonMws\AmazonFinancialGroupList;
44

5-
class AmazonFinancialGroupListTest extends PHPUnit_Framework_TestCase {
6-
5+
class AmazonFinancialGroupListTest extends PHPUnit_Framework_TestCase
6+
{
77
/**
88
* @var AmazonFinancialGroupList
99
*/
@@ -13,23 +13,26 @@ class AmazonFinancialGroupListTest extends PHPUnit_Framework_TestCase {
1313
* Sets up the fixture, for example, opens a network connection.
1414
* This method is called before a test is executed.
1515
*/
16-
protected function setUp() {
16+
protected function setUp()
17+
{
1718
resetLog();
1819
$this->object = new AmazonFinancialGroupList('testStore', true, null);
1920
}
2021

21-
public function testSetUseToken(){
22+
public function testSetUseToken()
23+
{
2224
$this->assertNull($this->object->setUseToken());
2325
$this->assertNull($this->object->setUseToken(true));
2426
$this->assertNull($this->object->setUseToken(false));
2527
$this->assertFalse($this->object->setUseToken('wrong'));
2628
}
2729

28-
public function testSetMaxResultsPerPage(){
30+
public function testSetMaxResultsPerPage()
31+
{
2932
$this->assertFalse($this->object->setMaxResultsPerPage(null)); //can't be nothing
3033
$this->assertFalse($this->object->setMaxResultsPerPage(-5)); //too low
3134
$this->assertFalse($this->object->setMaxResultsPerPage(150)); //too high
32-
$this->assertFalse($this->object->setMaxResultsPerPage(array(5, 7))); //not a valid value
35+
$this->assertFalse($this->object->setMaxResultsPerPage([5, 7])); //not a valid value
3336
$this->assertFalse($this->object->setMaxResultsPerPage('banana')); //what are you even doing
3437
$this->assertNull($this->object->setMaxResultsPerPage(77));
3538
$this->assertNull($this->object->setMaxResultsPerPage('75'));
@@ -39,23 +42,25 @@ public function testSetMaxResultsPerPage(){
3942
}
4043

4144
/**
42-
* @return array
43-
*/
44-
public function timeProvider() {
45-
return array(
46-
array(null, null, false, false), //nothing given, so no change
47-
array(time(), time(), true, true), //timestamps
48-
array('', '', false, false), //strings, but empty
49-
array('-1 min', null, true, false), //one set
50-
array(null, '-1 min', false, false), //other set
51-
array('-1 min', '-1 min', true, true), //both set
52-
);
45+
* @return array
46+
*/
47+
public function timeProvider()
48+
{
49+
return [
50+
[null, null, false, false], //nothing given, so no change
51+
[time(), time(), true, true], //timestamps
52+
['', '', false, false], //strings, but empty
53+
['-1 min', null, true, false], //one set
54+
[null, '-1 min', false, false], //other set
55+
['-1 min', '-1 min', true, true], //both set
56+
];
5357
}
5458

5559
/**
5660
* @dataProvider timeProvider
5761
*/
58-
public function testSetTimeLimits($a, $b, $c, $d){
62+
public function testSetTimeLimits($a, $b, $c, $d)
63+
{
5964
$try = $this->object->setTimeLimits($a, $b);
6065
$o = $this->object->getOptions();
6166
if ($c) {
@@ -79,7 +84,8 @@ public function testSetTimeLimits($a, $b, $c, $d){
7984
}
8085
}
8186

82-
public function testFetchGroupList() {
87+
public function testFetchGroupList()
88+
{
8389
resetLog();
8490
$this->object->setMock(true, 'fetchFinancialGroups.xml'); //no token
8591
$this->assertFalse($this->object->fetchGroupList()); //no date yet
@@ -99,7 +105,8 @@ public function testFetchGroupList() {
99105
return $this->object;
100106
}
101107

102-
public function testFetchGroupListToken1() {
108+
public function testFetchGroupListToken1()
109+
{
103110
resetLog();
104111
$this->object->setMock(true, 'fetchFinancialGroupsToken.xml');
105112
//without using token
@@ -117,9 +124,10 @@ public function testFetchGroupListToken1() {
117124
$this->assertCount(1, $r);
118125
}
119126

120-
public function testFetchGroupListToken2() {
127+
public function testFetchGroupListToken2()
128+
{
121129
resetLog();
122-
$this->object->setMock(true, array('fetchFinancialGroupsToken.xml', 'fetchFinancialGroupsToken2.xml'));
130+
$this->object->setMock(true, ['fetchFinancialGroupsToken.xml', 'fetchFinancialGroupsToken2.xml']);
123131

124132
//with using token
125133
$this->object->setUseToken();
@@ -144,7 +152,8 @@ public function testFetchGroupListToken2() {
144152
* @param AmazonFinancialGroupList $o
145153
* @depends testFetchGroupList
146154
*/
147-
public function testGetGroups($o) {
155+
public function testGetGroups($o)
156+
{
148157
$list = $o->getGroups();
149158
$this->assertInternalType('array', $list);
150159
$this->assertCount(2, $list);
@@ -180,7 +189,8 @@ public function testGetGroups($o) {
180189
* @param AmazonFinancialGroupList $o
181190
* @depends testFetchGroupList
182191
*/
183-
public function testGetGroupId($o) {
192+
public function testGetGroupId($o)
193+
{
184194
$this->assertEquals('22YgYW55IGNhcm5hbCBwbGVhEXAMPLE', $o->getGroupId(0));
185195
$this->assertEquals('22Y99995IGNhcm5hbANOTHEREXAMPLE', $o->getGroupId(1));
186196
$this->assertEquals($o->getGroupId(0), $o->getGroupId());
@@ -192,7 +202,8 @@ public function testGetGroupId($o) {
192202
* @param AmazonFinancialGroupList $o
193203
* @depends testFetchGroupList
194204
*/
195-
public function testGetProcessingStatus($o) {
205+
public function testGetProcessingStatus($o)
206+
{
196207
$this->assertEquals('Closed', $o->getProcessingStatus(0));
197208
$this->assertEquals('Closed2', $o->getProcessingStatus(1));
198209
$this->assertEquals($o->getProcessingStatus(0), $o->getProcessingStatus());
@@ -204,7 +215,8 @@ public function testGetProcessingStatus($o) {
204215
* @param AmazonFinancialGroupList $o
205216
* @depends testFetchGroupList
206217
*/
207-
public function testGetTransferStatus($o) {
218+
public function testGetTransferStatus($o)
219+
{
208220
$this->assertEquals('Successful', $o->getTransferStatus(0));
209221
$this->assertEquals('Successful2', $o->getTransferStatus(1));
210222
$this->assertEquals($o->getTransferStatus(0), $o->getTransferStatus());
@@ -216,11 +228,12 @@ public function testGetTransferStatus($o) {
216228
* @param AmazonFinancialGroupList $o
217229
* @depends testFetchGroupList
218230
*/
219-
public function testGetOriginalTotal($o) {
220-
$x0 = array();
231+
public function testGetOriginalTotal($o)
232+
{
233+
$x0 = [];
221234
$x0['Amount'] = '19.00';
222235
$x0['CurrencyCode'] = 'USD';
223-
$x1 = array();
236+
$x1 = [];
224237
$x1['Amount'] = '42.00';
225238
$x1['CurrencyCode'] = 'USD';
226239
$this->assertEquals($x0, $o->getOriginalTotal(0));
@@ -236,11 +249,12 @@ public function testGetOriginalTotal($o) {
236249
* @param AmazonFinancialGroupList $o
237250
* @depends testFetchGroupList
238251
*/
239-
public function testGetConvertedTotal($o) {
240-
$x0 = array();
252+
public function testGetConvertedTotal($o)
253+
{
254+
$x0 = [];
241255
$x0['Amount'] = '19.50';
242256
$x0['CurrencyCode'] = 'USD';
243-
$x1 = array();
257+
$x1 = [];
244258
$x1['Amount'] = '42.50';
245259
$x1['CurrencyCode'] = 'USD';
246260
$this->assertEquals($x0, $o->getConvertedTotal(0));
@@ -256,7 +270,8 @@ public function testGetConvertedTotal($o) {
256270
* @param AmazonFinancialGroupList $o
257271
* @depends testFetchGroupList
258272
*/
259-
public function testGetTransferDate($o) {
273+
public function testGetTransferDate($o)
274+
{
260275
$this->assertEquals('2014-09-09T01:30:00.000-06:00', $o->getTransferDate(0));
261276
$this->assertEquals('2014-10-09T01:30:00.000-06:00', $o->getTransferDate(1));
262277
$this->assertEquals($o->getTransferDate(0), $o->getTransferDate());
@@ -268,7 +283,8 @@ public function testGetTransferDate($o) {
268283
* @param AmazonFinancialGroupList $o
269284
* @depends testFetchGroupList
270285
*/
271-
public function testGetTraceId($o) {
286+
public function testGetTraceId($o)
287+
{
272288
$this->assertEquals('128311029381HSADJEXAMPLE', $o->getTraceId(0));
273289
$this->assertEquals('128999929381HADJEXAMPLE2', $o->getTraceId(1));
274290
$this->assertEquals($o->getTraceId(0), $o->getTraceId());
@@ -280,7 +296,8 @@ public function testGetTraceId($o) {
280296
* @param AmazonFinancialGroupList $o
281297
* @depends testFetchGroupList
282298
*/
283-
public function testGetAccountTail($o) {
299+
public function testGetAccountTail($o)
300+
{
284301
$this->assertEquals('1212', $o->getAccountTail(0));
285302
$this->assertEquals('1313', $o->getAccountTail(1));
286303
$this->assertEquals($o->getAccountTail(0), $o->getAccountTail());
@@ -292,11 +309,12 @@ public function testGetAccountTail($o) {
292309
* @param AmazonFinancialGroupList $o
293310
* @depends testFetchGroupList
294311
*/
295-
public function testGetBeginningBalance($o) {
296-
$x0 = array();
312+
public function testGetBeginningBalance($o)
313+
{
314+
$x0 = [];
297315
$x0['Amount'] = '0.00';
298316
$x0['CurrencyCode'] = 'USD';
299-
$x1 = array();
317+
$x1 = [];
300318
$x1['Amount'] = '20.00';
301319
$x1['CurrencyCode'] = 'USD';
302320
$this->assertEquals($x0, $o->getBeginningBalance(0));
@@ -312,7 +330,8 @@ public function testGetBeginningBalance($o) {
312330
* @param AmazonFinancialGroupList $o
313331
* @depends testFetchGroupList
314332
*/
315-
public function testGetStartDate($o) {
333+
public function testGetStartDate($o)
334+
{
316335
$this->assertEquals('2014-09-01T01:30:00.000-06:00', $o->getStartDate(0));
317336
$this->assertEquals('2014-10-01T01:30:00.000-06:00', $o->getStartDate(1));
318337
$this->assertEquals($o->getStartDate(0), $o->getStartDate());
@@ -324,14 +343,14 @@ public function testGetStartDate($o) {
324343
* @param AmazonFinancialGroupList $o
325344
* @depends testFetchGroupList
326345
*/
327-
public function testGetEndDate($o) {
346+
public function testGetEndDate($o)
347+
{
328348
$this->assertEquals('2014-09-09T01:30:00.000-06:00', $o->getEndDate(0));
329349
$this->assertEquals('2014-10-09T01:30:00.000-06:00', $o->getEndDate(1));
330350
$this->assertEquals($o->getEndDate(0), $o->getEndDate());
331351
//not fetched yet for this object
332352
$this->assertFalse($this->object->getEndDate());
333353
}
334-
335354
}
336355

337356
require_once __DIR__.'/../helperFunctions.php';

0 commit comments

Comments
 (0)