MonnifyAllowedPaymentSources::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Created By: Henry Ejemuta
4
 * Project: laravel-monnify
5
 * Class Name: MonnifyAllowedPaymentSources.php
6
 * Date Created: 7/14/20
7
 * Time Created: 5:11 PM
8
 */
9
10
namespace HenryEjemuta\LaravelMonnify\Classes;
11
12
13
class MonnifyAllowedPaymentSources
14
{
15
16
    private $bankAccounts = [];
17
    private $accountNames = [];
18
19
20
    /**
21
     * MonnifyAllowedPaymentSources constructor.
22
     * @param MonnifyBankAccount[] $monnifyBankAccounts
23
     */
24
    private function __construct(MonnifyBankAccount ...$monnifyBankAccounts)
25
    {
26
        foreach ($monnifyBankAccounts as $account){
27
            $this->bankAccounts[] = $account->getBankCodeAndAccountNumber();
28
            $this->accountNames[] = $account->getAccountName();
29
        }
30
    }
31
32
    public function toArray()
33
    {
34
        return [
35
            "bankAccounts" => $this->bankAccounts,
36
            "accountNames" => $this->accountNames,
37
        ];
38
    }
39
40
}
41