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

CreateAddress::firstName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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