AbstractLocationMessage   A
last analyzed

Complexity

Total Complexity 28

Size/Duplication

Total Lines 307
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 28
lcom 1
cbo 2
dl 0
loc 307
rs 10
c 0
b 0
f 0

28 Methods

Rating   Name   Duplication   Size   Complexity  
A getTel() 0 4 1
A setTel() 0 4 1
A getTel2() 0 4 1
A setTel2() 0 4 1
A getFax() 0 4 1
A setFax() 0 4 1
A getMail() 0 4 1
A setMail() 0 4 1
A getAddress() 0 4 1
A setAddress() 0 4 1
A getPostalCode() 0 4 1
A setPostalCode() 0 4 1
A getTown() 0 4 1
A setTown() 0 4 1
A getCountry() 0 4 1
A setCountry() 0 4 1
A getAddressForGoogleMap() 0 4 1
A setAddressForGoogleMap() 0 4 1
A isDefaultLocation() 0 4 1
A setDefaultLocation() 0 4 1
A getLatitude() 0 4 1
A setLatitude() 0 4 1
A getLongitude() 0 4 1
A setLongitude() 0 4 1
A getTranslations() 0 4 1
A addTranslation() 0 4 1
A removeTranslation() 0 4 1
A build() 0 18 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Yproximite\Api\Message\Location;
5
6
use Yproximite\Api\Message\MessageInterface;
7
use Yproximite\Api\Message\SiteAwareMessageTrait;
8
use Yproximite\Api\Util\Helper;
9
10
/**
11
 * Class AbstractLocationMessage
12
 */
13
abstract class AbstractLocationMessage implements MessageInterface
14
{
15
    use SiteAwareMessageTrait;
16
17
    /**
18
     * @var string
19
     */
20
    private $tel;
21
22
    /**
23
     * @var string|null
24
     */
25
    private $tel2;
26
27
    /**
28
     * @var string|null
29
     */
30
    private $fax;
31
32
    /**
33
     * @var string
34
     */
35
    private $mail;
36
37
    /**
38
     * @var string
39
     */
40
    private $address;
41
42
    /**
43
     * @var string
44
     */
45
    private $postalCode;
46
47
    /**
48
     * @var string
49
     */
50
    private $town;
51
52
    /**
53
     * @var string|null
54
     */
55
    private $country;
56
57
    /**
58
     * @var string|null
59
     */
60
    private $addressForGoogleMap;
61
62
    /**
63
     * @var bool|null
64
     */
65
    private $defaultLocation;
66
67
    /**
68
     * @var string|null
69
     */
70
    private $latitude;
71
72
    /**
73
     * @var string|null
74
     */
75
    private $longitude;
76
77
    /**
78
     * @var LocationTranslationMessage[]
79
     */
80
    private $translations = [];
81
82
    /**
83
     * @return string
84
     */
85
    public function getTel(): string
86
    {
87
        return $this->tel;
88
    }
89
90
    /**
91
     * @param string $tel
92
     */
93
    public function setTel(string $tel)
94
    {
95
        $this->tel = $tel;
96
    }
97
98
    /**
99
     * @return null|string
100
     */
101
    public function getTel2()
102
    {
103
        return $this->tel2;
104
    }
105
106
    /**
107
     * @param null|string $tel2
108
     */
109
    public function setTel2(string $tel2 = null)
110
    {
111
        $this->tel2 = $tel2;
112
    }
113
114
    /**
115
     * @return null|string
116
     */
117
    public function getFax()
118
    {
119
        return $this->fax;
120
    }
121
122
    /**
123
     * @param null|string $fax
124
     */
125
    public function setFax(string $fax = null)
126
    {
127
        $this->fax = $fax;
128
    }
129
130
    /**
131
     * @return string
132
     */
133
    public function getMail(): string
134
    {
135
        return $this->mail;
136
    }
137
138
    /**
139
     * @param string $mail
140
     */
141
    public function setMail(string $mail)
142
    {
143
        $this->mail = $mail;
144
    }
145
146
    /**
147
     * @return string
148
     */
149
    public function getAddress(): string
150
    {
151
        return $this->address;
152
    }
153
154
    /**
155
     * @param string $address
156
     */
157
    public function setAddress(string $address)
158
    {
159
        $this->address = $address;
160
    }
161
162
    /**
163
     * @return string
164
     */
165
    public function getPostalCode(): string
166
    {
167
        return $this->postalCode;
168
    }
169
170
    /**
171
     * @param string $postalCode
172
     */
173
    public function setPostalCode(string $postalCode)
174
    {
175
        $this->postalCode = $postalCode;
176
    }
177
178
    /**
179
     * @return string
180
     */
181
    public function getTown(): string
182
    {
183
        return $this->town;
184
    }
185
186
    /**
187
     * @param string $town
188
     */
189
    public function setTown(string $town)
190
    {
191
        $this->town = $town;
192
    }
193
194
    /**
195
     * @return null|string
196
     */
197
    public function getCountry()
198
    {
199
        return $this->country;
200
    }
201
202
    /**
203
     * @param null|string $country
204
     */
205
    public function setCountry(string $country = null)
206
    {
207
        $this->country = $country;
208
    }
209
210
    /**
211
     * @return null|string
212
     */
213
    public function getAddressForGoogleMap()
214
    {
215
        return $this->addressForGoogleMap;
216
    }
217
218
    /**
219
     * @param null|string $addressForGoogleMap
220
     */
221
    public function setAddressForGoogleMap(string $addressForGoogleMap = null)
222
    {
223
        $this->addressForGoogleMap = $addressForGoogleMap;
224
    }
225
226
    /**
227
     * @return bool|null
228
     */
229
    public function isDefaultLocation()
230
    {
231
        return $this->defaultLocation;
232
    }
233
234
    /**
235
     * @param bool|null $defaultLocation
236
     */
237
    public function setDefaultLocation(bool $defaultLocation = null)
238
    {
239
        $this->defaultLocation = $defaultLocation;
240
    }
241
242
    /**
243
     * @return null|string
244
     */
245
    public function getLatitude()
246
    {
247
        return $this->latitude;
248
    }
249
250
    /**
251
     * @param null|string $latitude
252
     */
253
    public function setLatitude(string $latitude = null)
254
    {
255
        $this->latitude = $latitude;
256
    }
257
258
    /**
259
     * @return null|string
260
     */
261
    public function getLongitude()
262
    {
263
        return $this->longitude;
264
    }
265
266
    /**
267
     * @param null|string $longitude
268
     */
269
    public function setLongitude(string $longitude = null)
270
    {
271
        $this->longitude = $longitude;
272
    }
273
274
    /**
275
     * @return LocationTranslationMessage[]
276
     */
277
    public function getTranslations(): array
278
    {
279
        return $this->translations;
280
    }
281
282
    /**
283
     * @param LocationTranslationMessage $translation
284
     */
285
    public function addTranslation(LocationTranslationMessage $translation)
286
    {
287
        $this->translations[] = $translation;
288
    }
289
290
    /**
291
     * @param LocationTranslationMessage $translation
292
     */
293
    public function removeTranslation(LocationTranslationMessage $translation)
294
    {
295
        array_splice($this->translations, array_search($translation, $this->translations), 1);
296
    }
297
298
    /**
299
     * {@inheritdoc}
300
     */
301
    public function build()
302
    {
303
        return [
304
            'tel'                 => $this->getTel(),
305
            'tel2'                => $this->getTel2(),
306
            'fax'                 => $this->getFax(),
307
            'mail'                => $this->getMail(),
308
            'address'             => $this->getAddress(),
309
            'postalCode'          => $this->getPostalCode(),
310
            'town'                => $this->getTown(),
311
            'country'             => $this->getCountry(),
312
            'addressForGoogleMap' => $this->getAddressForGoogleMap(),
313
            'defaultLocation'     => $this->isDefaultLocation(),
314
            'latitude'            => $this->getLatitude(),
315
            'longitude'           => $this->getLongitude(),
316
            'translations'        => Helper::buildMessages($this->getTranslations(), 'locale'),
317
        ];
318
    }
319
}
320