Shipping::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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