Failed Conditions
Pull Request — master (#229)
by
unknown
02:41
created

CreateAddress   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 156
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 10
lcom 0
cbo 0
dl 0
loc 156
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 25 1
A firstName() 0 4 1
A lastName() 0 4 1
A company() 0 4 1
A street() 0 4 1
A countryCode() 0 4 1
A provinceCode() 0 4 1
A city() 0 4 1
A postcode() 0 4 1
A phoneNumber() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Sylius\ShopApiPlugin\Command;
6
7
use Webmozart\Assert\Assert;
8
9
final class CreateAddress
10
{
11
    /**
12
     * @var string
13
     */
14
    private $firstName;
15
16
    /**
17
     * @var string
18
     */
19
    private $lastName;
20
21
    /**
22
     * @var string
23
     */
24
    private $company;
25
26
    /**
27
     * @var string
28
     */
29
    private $street;
30
31
    /**
32
     * @var string
33
     */
34
    private $countryCode;
35
36
    /**
37
     * @var string
38
     */
39
    private $provinceCode;
40
41
    /**
42
     * @var string
43
     */
44
    private $city;
45
46
    /**
47
     * @var string
48
     */
49
    private $postcode;
50
51
    /**
52
     * @var string
53
     */
54
    private $phoneNumber;
55
56
    /**
57
     * @param $firstName
58
     * @param $lastName
59
     * @param $company
60
     * @param $street
61
     * @param $countryCode
62
     * @param $provinceCode
63
     * @param $city
64
     * @param $postcode
65
     * @param $phoneNumber
66
     */
67
    public function __construct($firstName, $lastName, $company, $street, $countryCode, $provinceCode, $city, $postcode, $phoneNumber)
68
    {
69
        Assert::allString([
70
            $firstName,
71
            $lastName,
72
            $street,
73
            $countryCode,
74
            $city,
75
            $postcode,
76
        ]);
77
78
        Assert::nullOrString($company);
79
        Assert::nullOrString($provinceCode);
80
        Assert::nullOrString($phoneNumber);
81
82
        $this->firstName = $firstName;
83
        $this->lastName = $lastName;
84
        $this->company = $company;
85
        $this->street = $street;
86
        $this->countryCode = $countryCode;
87
        $this->provinceCode = $provinceCode;
88
        $this->city = $city;
89
        $this->postcode = $postcode;
90
        $this->phoneNumber = $phoneNumber;
91
    }
92
93
    /**
94
     * @return string
95
     */
96
    public function firstName(): string
97
    {
98
        return $this->firstName;
99
    }
100
101
    /**
102
     * @return string
103
     */
104
    public function lastName(): string
105
    {
106
        return $this->lastName;
107
    }
108
109
    /**
110
     * @return string|null
111
     */
112
    public function company(): ?string
113
    {
114
        return $this->company;
115
    }
116
117
    /**
118
     * @return string
119
     */
120
    public function street(): string
121
    {
122
        return $this->street;
123
    }
124
125
    /**
126
     * @return string
127
     */
128
    public function countryCode(): string
129
    {
130
        return $this->countryCode;
131
    }
132
133
    /**
134
     * @return string|null
135
     */
136
    public function provinceCode(): ?string
137
    {
138
        return $this->provinceCode;
139
    }
140
141
    /**
142
     * @return string
143
     */
144
    public function city(): string
145
    {
146
        return $this->city;
147
    }
148
149
    /**
150
     * @return string
151
     */
152
    public function postcode(): string
153
    {
154
        return $this->postcode;
155
    }
156
157
    /**
158
     * @return string|null
159
     */
160
    public function phoneNumber(): ?string
161
    {
162
        return $this->phoneNumber;
163
    }
164
}
165