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

Commit

Permalink
When there are no payments return an empty array instead of null.
Browse files Browse the repository at this point in the history
  • Loading branch information
jarnovanleeuwen committed Dec 12, 2017
1 parent 21588bd commit 1daa28c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Entities/PaymentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class PaymentRequest extends AbstractEntity
/**
* @var Payment[]
*/
public $payments;
public $payments = [];

/**
* @var string
Expand Down Expand Up @@ -93,9 +93,9 @@ public function setAttributes(array $attributes)
}
}

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

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

Expand Down
4 changes: 2 additions & 2 deletions src/Entities/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public function setAttributes(array $attributes)
{
parent::setAttributes($attributes);

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

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

Expand Down

0 comments on commit 1daa28c

Please sign in to comment.