Skip to content
This repository was archived by the owner on Dec 28, 2020. It is now read-only.

Commit 1daa28c

Browse files
When there are no payments return an empty array instead of null.
1 parent 21588bd commit 1daa28c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Entities/PaymentRequest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class PaymentRequest extends AbstractEntity
4343
/**
4444
* @var Payment[]
4545
*/
46-
public $payments;
46+
public $payments = [];
4747

4848
/**
4949
* @var string
@@ -93,9 +93,9 @@ public function setAttributes(array $attributes)
9393
}
9494
}
9595

96-
if ($payments = $attributes['payments'] ?? null) {
97-
$this->payments = [];
96+
$this->payments = [];
9897

98+
if ($payments = $attributes['payments'] ?? null) {
9999
foreach ($payments as $paymentData) {
100100
$payment = new Payment($this->getTikkie());
101101

src/Entities/User.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public function setAttributes(array $attributes)
5454
{
5555
parent::setAttributes($attributes);
5656

57-
if ($bankAccounts = $attributes['bankAccounts'] ?? null) {
58-
$this->bankAccounts = [];
57+
$this->bankAccounts = [];
5958

59+
if ($bankAccounts = $attributes['bankAccounts'] ?? null) {
6060
foreach ($bankAccounts as $bankAccountData) {
6161
$bankAccount = new BankAccount($this->getTikkie());
6262

0 commit comments

Comments
 (0)