Completed
Push — master ( bdfee2...e6cd81 )
by Olivier
02:17
created

Settings::createFromArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 8
cts 8
cp 1
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Shapin\Stripe\Model\Account;
11
12
use Shapin\Stripe\Model\CreatableFromArray;
13
14
final class Settings implements CreatableFromArray
15
{
16
    /**
17
     * @var array
18
     */
19
    private $branding;
20
21
    /**
22
     * @var array
23
     */
24
    private $cardPayments;
25
26
    /**
27
     * @var array
28
     */
29
    private $dashboard;
30
31
    /**
32
     * @var array
33
     */
34
    private $payments;
35
36
    /**
37
     * @var array
38
     */
39
    private $payouts;
40
41 5
    private function __construct()
42
    {
43 5
    }
44
45 5
    public static function createFromArray(array $data)
46
    {
47 5
        $model = new self();
48 5
        $model->branding = $data['branding'];
49 5
        $model->cardPayments = $data['card_payments'];
50 5
        $model->dashboard = $data['dashboard'];
51 5
        $model->payments = $data['payments'];
52 5
        $model->payouts = $data['payouts'] ?? [];
53
54 5
        return $model;
55
    }
56
57
    public function getBranding(): array
58
    {
59
        return $this->branding;
60
    }
61
62
    public function getCardPayments(): array
63
    {
64
        return $this->cardPayments;
65
    }
66
67
    public function getDashboard(): array
68
    {
69
        return $this->dashboard;
70
    }
71
72
    public function getPayments(): array
73
    {
74
        return $this->payments;
75
    }
76
77
    public function getPayouts(): array
78
    {
79
        return $this->payouts;
80
    }
81
}
82