Skip to content

Commit

Permalink
Add support of php 7.3 for OrderLine model
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Samofal committed Jan 27, 2022
1 parent c15885c commit eb82ef7
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/Models/OrderLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,38 @@

class OrderLine
{
const TYPE_PHYSICAL = 'physical';
const TYPE_DISCOUNT = 'discount';
const TYPE_SHIPPING_FEE = 'shipping_fee';
const TYPE_SALES_TAX = 'sales_tax';
const TYPE_DIGITAL = 'digital';
const TYPE_GIFT_CARD = 'gift_card';
const TYPE_STORE_CREDIT = 'store_credit';
const TYPE_SURCHARGE = 'surcharge';
public const TYPE_PHYSICAL = 'physical';
public const TYPE_DISCOUNT = 'discount';
public const TYPE_SHIPPING_FEE = 'shipping_fee';
public const TYPE_SALES_TAX = 'sales_tax';
public const TYPE_DIGITAL = 'digital';
public const TYPE_GIFT_CARD = 'gift_card';
public const TYPE_STORE_CREDIT = 'store_credit';
public const TYPE_SURCHARGE = 'surcharge';

public string $type;
public string $reference;
public string $name;
public int $quantity;
public int $unit_price;
public int $tax_rate;
public int $total_amount;
public int $total_discount_amount;
public ?int $total_tax_amount = null;
public string $merchant_data;
public ?string $product_url = null;
public ?string $image_url = null;
public $type;
public $reference;
public $name;
public $quantity;
public $unit_price;
public $tax_rate;
public $total_amount;
public $total_discount_amount;
public $total_tax_amount;
public $merchant_data;
public $product_url;
public $image_url;

public function __construct(array $data)
public function __construct(array $orderLine)
{
foreach ($data as $prop => $value) {
foreach ($orderLine as $prop => $value) {
if (property_exists($this, $prop)) {
$this->$prop = $value;
}
}
}

public function toArray()
public function toArray(): array
{
return [
'type' => $this->type,
Expand All @@ -52,4 +52,4 @@ public function toArray()
'image_url' => $this->image_url,
];
}
}
}

0 comments on commit eb82ef7

Please sign in to comment.