Passed
Branch master (461ffe)
by João Felipe Magro
05:37 queued 02:32
created

Address::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Ipag\Classes;
4
5
use Ipag\Classes\Contracts\Emptiable;
6
use Ipag\Classes\Traits\EmptiableTrait;
7
8
final class Address extends BaseResource implements Emptiable
9
{
10
    use EmptiableTrait;
11
12
    /**
13
     * @var string
14
     */
15
    private $street;
16
17
    /**
18
     * @var string
19
     */
20
    private $number;
21
22
    /**
23
     * @var string
24
     */
25
    private $complement;
26
27
    /**
28
     * @var string
29
     */
30
    private $neighborhood;
31
32
    /**
33
     * @var string
34
     */
35
    private $city;
36
37
    /**
38
     * @var string
39
     */
40
    private $state;
41
42
    /**
43
     * @var string
44
     */
45
    private $country;
46
47
    /**
48
     * @var string
49
     */
50
    private $zipCode;
51
52
    /**
53
     * @return string
54
     */
55
    public function getStreet()
56
    {
57
        return $this->street;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getNumber()
64
    {
65
        return $this->number;
66
    }
67
68
    /**
69
     * @return string
70
     */
71
    public function getComplement()
72
    {
73
        return $this->complement;
74
    }
75
76
    /**
77
     * @return string
78
     */
79
    public function getNeighborhood()
80
    {
81
        return $this->neighborhood;
82
    }
83
84
    /**
85
     * @return string
86
     */
87
    public function getCity()
88
    {
89
        return $this->city;
90
    }
91
92
    /**
93
     * @return string
94
     */
95
    public function getState()
96
    {
97
        return $this->state;
98
    }
99
100
    /**
101
     * @return string
102
     */
103
    public function getCountry()
104
    {
105
        if (is_null($this->country)) {
106
            $this->setCountry('BR');
107
        }
108
109
        return $this->country;
110
    }
111
112
    /**
113
     * @return string
114
     */
115
    public function getZipCode()
116
    {
117
        return $this->zipCode;
118
    }
119
120
    /**
121
     * @param string street
122
     */
123
    public function setStreet($street)
124
    {
125
        $this->street = substr((string) $street, 0, 100);
126
127
        return $this;
128
    }
129
130
    /**
131
     * @param string number
132
     */
133
    public function setNumber($number)
134
    {
135
        $this->number = substr((string) $number, 0, 15);
136
137
        return $this;
138
    }
139
140
    /**
141
     * @param string complement
142
     */
143
    public function setComplement($complement)
144
    {
145
        $this->complement = substr((string) $complement, 0, 255);
146
147
        return $this;
148
    }
149
150
    /**
151
     * @param string neighborhood
152
     */
153
    public function setNeighborhood($neighborhood)
154
    {
155
        $this->neighborhood = substr((string) $neighborhood, 0, 40);
156
157
        return $this;
158
    }
159
160
    /**
161
     * @param string city
162
     */
163
    public function setCity($city)
164
    {
165
        $this->city = substr((string) $city, 0, 40);
166
167
        return $this;
168
    }
169
170
    /**
171
     * @param string state
172
     */
173
    public function setState($state)
174
    {
175
        $this->state = substr((string) $state, 0, 2);
176
177
        return $this;
178
    }
179
180
    /**
181
     * @param string country
182
     */
183
    public function setCountry($country)
184
    {
185
        $this->country = substr($country, 0, 3);
186
187
        return $this;
188
    }
189
190
    /**
191
     * @param string zipCode
192
     */
193
    public function setZipCode($zipCode)
194
    {
195
        $this->zipCode = substr($this->getNumberUtil()->getOnlyNumbers($zipCode), 0, 8);
196
197
        return $this;
198
    }
199
}
200