InvoiceSettings::getFooter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\Customer;
11
12
use Shapin\Stripe\Model\CreatableFromArray;
13
14
final class InvoiceSettings implements CreatableFromArray
15
{
16
    /**
17
     * @var array
18
     */
19
    private $customFields;
20
21
    /**
22
     * @var ?string
23
     */
24
    private $footer;
25
26 5
    private function __construct()
27
    {
28 5
    }
29
30 5
    public static function createFromArray(array $data): self
31
    {
32 5
        $customFields = [];
33 5
        if (isset($data['custom_fields'])) {
34
            foreach ($data['custom_fields'] as $customField) {
35
                $customFields[] = new CustomField($customField['name'], $customField['value']);
36
            }
37
        }
38
39 5
        $model = new self();
40 5
        $model->customFields = $customFields;
41 5
        $model->footer = $data['footer'];
42
43 5
        return $model;
44
    }
45
46 1
    public function getCustomFields(): array
47
    {
48 1
        return $this->customFields;
49
    }
50
51 1
    public function getFooter(): ?string
52
    {
53 1
        return $this->footer;
54
    }
55
}
56