Skip to content

Commit

Permalink
Apply styleci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav.kuryan committed May 4, 2019
1 parent 98a977f commit e153023
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 64 deletions.
16 changes: 8 additions & 8 deletions src/iTunes/PurchaseItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class PurchaseItem implements ArrayAccess
protected $is_in_intro_offer_period;

/**
* When a subscriber redeems an offer, there is a promotional offer ID
* When a subscriber redeems an offer, there is a promotional offer ID.
*
* @var string|null
*/
Expand Down Expand Up @@ -115,9 +115,9 @@ public function __construct(?array $data = null)
/**
* Parse Data from JSON Response.
*
* @return $this
* @throws RunTimeException
*
* @return $this
*/
public function parseData(): self
{
Expand All @@ -126,7 +126,7 @@ public function parseData(): self
}

if (array_key_exists('quantity', $this->raw_data)) {
$this->quantity = (int)$this->raw_data['quantity'];
$this->quantity = (int) $this->raw_data['quantity'];
}

if (array_key_exists('transaction_id', $this->raw_data)) {
Expand Down Expand Up @@ -162,27 +162,27 @@ public function parseData(): self

if (array_key_exists('purchase_date_ms', $this->raw_data)) {
$this->purchase_date = Carbon::createFromTimestampUTC(
(int)round($this->raw_data['purchase_date_ms'] / 1000)
(int) round($this->raw_data['purchase_date_ms'] / 1000)
);
}

if (array_key_exists('original_purchase_date_ms', $this->raw_data)) {
$this->original_purchase_date = Carbon::createFromTimestampUTC(
(int)round($this->raw_data['original_purchase_date_ms'] / 1000)
(int) round($this->raw_data['original_purchase_date_ms'] / 1000)
);
}

if (array_key_exists('expires_date_ms', $this->raw_data)) {
$this->expires_date = Carbon::createFromTimestampUTC((int)round($this->raw_data['expires_date_ms'] / 1000));
$this->expires_date = Carbon::createFromTimestampUTC((int) round($this->raw_data['expires_date_ms'] / 1000));
} elseif (array_key_exists('expires_date', $this->raw_data) && is_numeric($this->raw_data['expires_date'])) {
$this->expires_date = Carbon::createFromTimestampUTC(
(int)round((int)$this->raw_data['expires_date'] / 1000)
(int) round((int) $this->raw_data['expires_date'] / 1000)
);
}

if (array_key_exists('cancellation_date_ms', $this->raw_data)) {
$this->cancellation_date = Carbon::createFromTimestampUTC(
(int)round($this->raw_data['cancellation_date_ms'] / 1000)
(int) round($this->raw_data['cancellation_date_ms'] / 1000)
);
}

Expand Down
112 changes: 56 additions & 56 deletions tests/iTunes/PurchaseItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ public function testInvalidTypeToConstructor(): void
public function testPurchaseData(): void
{
$raw_data = [
'is_trial_period' => 'false',
'original_purchase_date' => '2015-05-24 01:06:58 Etc\/GMT',
'original_purchase_date_ms' => 1432429618000,
'is_trial_period' => 'false',
'original_purchase_date' => '2015-05-24 01:06:58 Etc\/GMT',
'original_purchase_date_ms' => 1432429618000,
'original_purchase_date_pst' => '2015-05-23 18:06:58 America\/Los_Angeles',
'original_transaction_id' => 1000000156455961,
'product_id' => 'myapp.1',
'purchase_date' => '2015-05-24 01:06:58 Etc\/GMT',
'purchase_date_ms' => 1432429618000,
'purchase_date_pst' => '2015-05-23 18:06:58 America\/Los_Angeles',
'quantity' => 1,
'transaction_id' => 1000000156455961,
'original_transaction_id' => 1000000156455961,
'product_id' => 'myapp.1',
'purchase_date' => '2015-05-24 01:06:58 Etc\/GMT',
'purchase_date_ms' => 1432429618000,
'purchase_date_pst' => '2015-05-23 18:06:58 America\/Los_Angeles',
'quantity' => 1,
'transaction_id' => 1000000156455961,
];

$info = new PurchaseItem($raw_data);
Expand Down Expand Up @@ -74,22 +74,22 @@ public function testPurchaseData(): void
public function testSubscriptionPurchaseData(): void
{
$raw_data = [
'quantity' => '1',
'product_id' => 'product.subscription',
'transaction_id' => '720000261479083',
'original_transaction_id' => '720000261479083',
'purchase_date' => '2018-06-14 05:41:29 Etc/GMT',
'purchase_date_ms' => 1528954889000,
'purchase_date_pst' => '2018-06-13 22:41:29 America/Los_Angeles',
'original_purchase_date' => '2018-06-14 05:41:31 Etc/GMT',
'original_purchase_date_ms' => 1528954891000,
'quantity' => '1',
'product_id' => 'product.subscription',
'transaction_id' => '720000261479083',
'original_transaction_id' => '720000261479083',
'purchase_date' => '2018-06-14 05:41:29 Etc/GMT',
'purchase_date_ms' => 1528954889000,
'purchase_date_pst' => '2018-06-13 22:41:29 America/Los_Angeles',
'original_purchase_date' => '2018-06-14 05:41:31 Etc/GMT',
'original_purchase_date_ms' => 1528954891000,
'original_purchase_date_pst' => '2018-06-13 22:41:31 America/Los_Angeles',
'expires_date' => '2018-06-21 05:41:29 Etc/GMT',
'expires_date_ms' => 1529559689000,
'expires_date_pst' => '2018-06-20 22:41:29 America/Los_Angeles',
'web_order_line_item_id' => 720000062004133,
'is_trial_period' => true,
'is_in_intro_offer_period' => false,
'expires_date' => '2018-06-21 05:41:29 Etc/GMT',
'expires_date_ms' => 1529559689000,
'expires_date_pst' => '2018-06-20 22:41:29 America/Los_Angeles',
'web_order_line_item_id' => 720000062004133,
'is_trial_period' => true,
'is_in_intro_offer_period' => false,
];

$info = new PurchaseItem($raw_data);
Expand Down Expand Up @@ -121,22 +121,22 @@ public function testSubscriptionPurchaseData(): void
public function testPurchaseDataWithoutWebOrderLineItemId(): void
{
$raw_data = [
'quantity' => '1',
'product_id' => 'product.subscription',
'transaction_id' => '720000261479083',
'original_transaction_id' => '720000261479083',
'purchase_date' => '2018-06-14 05:41:29 Etc/GMT',
'purchase_date_ms' => 1528954889000,
'purchase_date_pst' => '2018-06-13 22:41:29 America/Los_Angeles',
'original_purchase_date' => '2018-06-14 05:41:31 Etc/GMT',
'original_purchase_date_ms' => 1528954891000,
'quantity' => '1',
'product_id' => 'product.subscription',
'transaction_id' => '720000261479083',
'original_transaction_id' => '720000261479083',
'purchase_date' => '2018-06-14 05:41:29 Etc/GMT',
'purchase_date_ms' => 1528954889000,
'purchase_date_pst' => '2018-06-13 22:41:29 America/Los_Angeles',
'original_purchase_date' => '2018-06-14 05:41:31 Etc/GMT',
'original_purchase_date_ms' => 1528954891000,
'original_purchase_date_pst' => '2018-06-13 22:41:31 America/Los_Angeles',
'expires_date' => '2018-06-21 05:41:29 Etc/GMT',
'expires_date_ms' => 1529559689000,
'expires_date_pst' => '2018-06-20 22:41:29 America/Los_Angeles',
'web_order_line_item_id' => null,
'is_trial_period' => true,
'is_in_intro_offer_period' => false,
'expires_date' => '2018-06-21 05:41:29 Etc/GMT',
'expires_date_ms' => 1529559689000,
'expires_date_pst' => '2018-06-20 22:41:29 America/Los_Angeles',
'web_order_line_item_id' => null,
'is_trial_period' => true,
'is_in_intro_offer_period' => false,
];

$info = new PurchaseItem($raw_data);
Expand Down Expand Up @@ -168,23 +168,23 @@ public function testPurchaseDataWithoutWebOrderLineItemId(): void
public function testPurchaseDataWithPromotionalOfferId(): void
{
$raw_data = [
'quantity' => '1',
'product_id' => 'product.subscription',
'transaction_id' => '720000261479083',
'original_transaction_id' => '720000261479083',
'purchase_date' => '2018-06-14 05:41:29 Etc/GMT',
'purchase_date_ms' => 1528954889000,
'purchase_date_pst' => '2018-06-13 22:41:29 America/Los_Angeles',
'original_purchase_date' => '2018-06-14 05:41:31 Etc/GMT',
'original_purchase_date_ms' => 1528954891000,
'quantity' => '1',
'product_id' => 'product.subscription',
'transaction_id' => '720000261479083',
'original_transaction_id' => '720000261479083',
'purchase_date' => '2018-06-14 05:41:29 Etc/GMT',
'purchase_date_ms' => 1528954889000,
'purchase_date_pst' => '2018-06-13 22:41:29 America/Los_Angeles',
'original_purchase_date' => '2018-06-14 05:41:31 Etc/GMT',
'original_purchase_date_ms' => 1528954891000,
'original_purchase_date_pst' => '2018-06-13 22:41:31 America/Los_Angeles',
'expires_date' => '2018-06-21 05:41:29 Etc/GMT',
'expires_date_ms' => 1529559689000,
'expires_date_pst' => '2018-06-20 22:41:29 America/Los_Angeles',
'web_order_line_item_id' => null,
'is_trial_period' => true,
'is_in_intro_offer_period' => false,
'promotional_offer_id' => 'PROMOOFFER'
'expires_date' => '2018-06-21 05:41:29 Etc/GMT',
'expires_date_ms' => 1529559689000,
'expires_date_pst' => '2018-06-20 22:41:29 America/Los_Angeles',
'web_order_line_item_id' => null,
'is_trial_period' => true,
'is_in_intro_offer_period' => false,
'promotional_offer_id' => 'PROMOOFFER',
];

$info = new PurchaseItem($raw_data);
Expand Down

0 comments on commit e153023

Please sign in to comment.