Shipping   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 46
ccs 0
cts 23
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A createFromArray() 0 9 1
A getAddress() 0 4 1
A getName() 0 4 1
A getPhone() 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\Customer;
11
12
use Shapin\Stripe\Model\Address;
13
use Shapin\Stripe\Model\CreatableFromArray;
14
15
final class Shipping implements CreatableFromArray
16
{
17
    /**
18
     * @var Address
19
     */
20
    private $address;
21
22
    /**
23
     * @var string
24
     */
25
    private $name;
26
27
    /**
28
     * @var string
29
     */
30
    private $phone;
31
32
    private function __construct()
33
    {
34
    }
35
36
    public static function createFromArray(array $data): self
37
    {
38
        $model = new self();
39
        $model->address = Address::createFromArray($data['address']);
40
        $model->name = $data['name'];
41
        $model->phone = $data['phone'];
42
43
        return $model;
44
    }
45
46
    public function getAddress(): Address
47
    {
48
        return $this->address;
49
    }
50
51
    public function getName(): ?string
52
    {
53
        return $this->name;
54
    }
55
56
    public function getPhone(): ?string
57
    {
58
        return $this->phone;
59
    }
60
}
61