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

BusinessProfile   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 1
dl 0
loc 97
ccs 27
cts 27
cp 1
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A createFromArray() 0 14 2
A getMerchantCategoryCode() 0 4 1
A getName() 0 4 1
A getProductDescription() 0 4 1
A getSupportAddress() 0 4 1
A getSupportEmail() 0 4 1
A getSupportPhone() 0 4 1
A getSupportUrl() 0 4 1
A getUrl() 0 4 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\Address;
13
use Shapin\Stripe\Model\CreatableFromArray;
14
15
final class BusinessProfile implements CreatableFromArray
16
{
17
    /**
18
     * @var ?string
19
     */
20
    private $merchantCategoryCode;
21
22
    /**
23
     * @var ?string
24
     */
25
    private $name;
26
27
    /**
28
     * @var ?string
29
     */
30
    private $productDescription;
31
32
    /**
33
     * @var ?Address
34
     */
35
    private $supportAddress;
36
37
    /**
38
     * @var ?string
39
     */
40
    private $supportEmail;
41
42
    /**
43
     * @var ?string
44
     */
45
    private $supportPhone;
46
47
    /**
48
     * @var ?string
49
     */
50
    private $supportUrl;
51
52
    /**
53
     * @var ?string
54
     */
55
    private $url;
56
57 5
    public static function createFromArray(array $data)
58
    {
59 5
        $model = new self();
60 5
        $model->merchantCategoryCode = $data['mcc'];
61 5
        $model->name = $data['name'];
62 5
        $model->productDescription = $data['product_description'] ?? null;
63 5
        $model->supportAddress = isset($data['support_address']) ? Address::createFromArray($data['support_address']) : null;
64 5
        $model->supportEmail = $data['support_email'];
65 5
        $model->supportPhone = $data['support_phone'];
66 5
        $model->supportUrl = $data['support_url'];
67 5
        $model->url = $data['url'];
68
69 5
        return $model;
70
    }
71
72 1
    public function getMerchantCategoryCode(): ?string
73
    {
74 1
        return $this->merchantCategoryCode;
75
    }
76
77 1
    public function getName(): ?string
78
    {
79 1
        return $this->name;
80
    }
81
82 1
    public function getProductDescription(): ?string
83
    {
84 1
        return $this->productDescription;
85
    }
86
87 1
    public function getSupportAddress(): ?Address
88
    {
89 1
        return $this->supportAddress;
90
    }
91
92 1
    public function getSupportEmail(): ?string
93
    {
94 1
        return $this->supportEmail;
95
    }
96
97 1
    public function getSupportPhone(): ?string
98
    {
99 1
        return $this->supportPhone;
100
    }
101
102 1
    public function getSupportUrl(): ?string
103
    {
104 1
        return $this->supportUrl;
105
    }
106
107 1
    public function getUrl(): ?string
108
    {
109 1
        return $this->url;
110
    }
111
}
112