Passed
Push — master ( 7851cb...6ae504 )
by Aimeos
04:36
created

FosUser::setMobile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @license MIT, http://opensource.org/licenses/MIT
5
 * @copyright Aimeos (aimeos.org), 2015
6
 */
7
8
9
namespace Aimeos\ShopBundle\Entity;
10
11
use Doctrine\ORM\Mapping as ORM;
12
use FOS\UserBundle\Model\User as BaseUser;
13
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
14
15
16
/**
17
 * @ORM\Entity
18
 * @ORM\Table("fos_user")
19
 */
20
class FosUser extends BaseUser implements PasswordAuthenticatedUserInterface
21
{
22
	/**
23
	 * @ORM\Id
24
	 * @ORM\Column("id")
25
	 */
26
	protected $id;
27
28
	/**
29
	 * @ORM\Column("siteid")
30
	 */
31
	protected $siteid;
32
33
	/**
34
	 * @ORM\Column("salutation")
35
	 */
36
	protected $salutation = '';
37
38
	/**
39
	 * @ORM\Column("company")
40
	 */
41
	protected $company = '';
42
43
	/**
44
	 * @ORM\Column("vatid")
45
	 */
46
	protected $vatid = '';
47
48
	/**
49
	 * @ORM\Column("title")
50
	 */
51
	protected $title = '';
52
53
	/**
54
	 * @ORM\Column("firstname")
55
	 */
56
	protected $firstname = '';
57
58
	/**
59
	 * @ORM\Column("lastname")
60
	 */
61
	protected $lastname = '';
62
63
	/**
64
	 * @ORM\Column("address1")
65
	 */
66
	protected $address1 = '';
67
68
	/**
69
	 * @ORM\Column("address2")
70
	 */
71
	protected $address2 = '';
72
73
	/**
74
	 * @ORM\Column("address3")
75
	 */
76
	protected $address3 = '';
77
78
	/**
79
	 * @ORM\Column("postal")
80
	 */
81
	protected $postal = '';
82
83
	/**
84
	 * @ORM\Column("city")
85
	 */
86
	protected $city = '';
87
88
	/**
89
	 * @ORM\Column("state")
90
	 */
91
	protected $state = '';
92
93
	/**
94
	 * @ORM\Column("langid")
95
	 */
96
	protected $langid = null;
97
98
	/**
99
	 * @ORM\Column("countryid")
100
	 */
101
	protected $countryid = null;
102
103
	/**
104
	 * @ORM\Column("telephone")
105
	 */
106
	protected $telephone = '';
107
108
	/**
109
	 * @ORM\Column("telefax")
110
	 */
111
	protected $telefax = '';
112
113
	/**
114
	 * @ORM\Column("mobile")
115
	 */
116
	protected $mobile = '';
117
118
	/**
119
	 * @ORM\Column("website")
120
	 */
121
	protected $website = '';
122
123
	/**
124
	 * @ORM\Column("longitude")
125
	 */
126
	protected $longitude;
127
128
	/**
129
	 * @ORM\Column("latitude")
130
	 */
131
	protected $latitude;
132
133
	/**
134
	 * @ORM\Column("birthday")
135
	 */
136
	protected $birthday;
137
138
	/**
139
	 * @ORM\Column("vdate")
140
	 */
141
	protected $vdate;
142
143
	/**
144
	 * @ORM\Column("ctime")
145
	 */
146
	protected $ctime;
147
148
	/**
149
	 * @ORM\Column("mtime")
150
	 */
151
	protected $mtime;
152
153
	/**
154
	 * @ORM\Column("editor")
155
	 */
156
	protected $editor = '';
157
158
159
	public function __construct()
160
	{
161
		parent::__construct();
162
163
		$this->ctime = new \DateTime();
164
		$this->mtime = new \DateTime();
165
	}
166
167
168
	public function getUserIdentifier() : string
169
	{
170
		return $this->code;
0 ignored issues
show
Bug Best Practice introduced by
The property code does not exist on Aimeos\ShopBundle\Entity\FosUser. Did you maybe forget to declare it?
Loading history...
171
	}
172
173
174
	/**
175
	 * Returns the user unique ID.
176
	 *
177
	 * @return string|null
178
	 */
179
	public function getId() : ?string
180
	{
181
		return $this->id;
182
	}
183
184
185
	/**
186
	 * Returns the site ID of the user.
187
	 *
188
	 * @return mixed
189
	 */
190
	public function getSiteId() : ?string
191
	{
192
		return $this->siteid;
193
	}
194
195
196
	/**
197
	 * Returns the company name.
198
	 *
199
	 * @return string Company name
200
	 */
201
	public function getCompany() : string
202
	{
203
		return (string) $this->company;
204
	}
205
206
207
	/**
208
	 * Sets a new company name.
209
	 *
210
	 * @param string $company New company name
211
	 */
212
	public function setCompany( string $company )
213
	{
214
		$this->company = (string) $company;
215
	}
216
217
218
	/**
219
	 * Returns the vatid.
220
	 *
221
	 * @return string vatid
222
	 */
223
	public function getVatId() : string
224
	{
225
		return (string) $this->vatid;
226
	}
227
228
229
	/**
230
	 * Sets a new vatid.
231
	 *
232
	 * @param string $vatid New vatid
233
	 */
234
	public function setVatID( string $vatid )
235
	{
236
		$this->vatid = (string) $vatid;
237
	}
238
239
240
	/**
241
	 * Returns the salutation constant for the person described by the address.
242
	 *
243
	 * @return string Saluatation constant defined in \Aimeos\MShop\Common\Item\Address\Base
244
	 */
245
	public function getSalutation() : string
246
	{
247
		return $this->salutation ?? \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN;
248
	}
249
250
251
	/**
252
	 * Sets the new salutation for the person described by the address.
253
	 *
254
	 * @param string $salutation Salutation constant defined in \Aimeos\MShop\Common\Item\Address\Base
255
	 */
256
	public function setSalutation( string $salutation )
257
	{
258
		$this->salutation = $salutation;
259
	}
260
261
262
	/**
263
	 * Returns the title of the person.
264
	 *
265
	 * @return string Title of the person
266
	 */
267
	public function getTitle() : string
268
	{
269
		return (string) $this->title;
270
	}
271
272
273
	/**
274
	 * Sets a new title of the person.
275
	 *
276
	 * @param string $title New title of the person
277
	 */
278
	public function setTitle( string $title )
279
	{
280
		$this->title = $title;
281
	}
282
283
284
	/**
285
	 * Returns the first name of the person.
286
	 *
287
	 * @return string First name of the person
288
	 */
289
	public function getFirstname() : string
290
	{
291
		return (string) $this->firstname;
292
	}
293
294
295
	/**
296
	 * Sets a new first name of the person.
297
	 *
298
	 * @param string $firstname New first name of the person
299
	 */
300
	public function setFirstname( string $firstname )
301
	{
302
		$this->firstname = $firstname;
303
	}
304
305
306
	/**
307
	 * Returns the last name of the person.
308
	 *
309
	 * @return string Last name of the person
310
	 */
311
	public function getLastname() : string
312
	{
313
		return (string) $this->lastname;
314
	}
315
316
317
	/**
318
	 * Sets a new last name of the person.
319
	 *
320
	 * @param string $lastname New last name of the person
321
	 */
322
	public function setLastname( string $lastname )
323
	{
324
		$this->lastname = $lastname;
325
	}
326
327
328
	/**
329
	 * Returns the first address part, e.g. the street name.
330
	 *
331
	 * @return string First address part
332
	 */
333
	public function getAddress1() : string
334
	{
335
		return (string) $this->address1;
336
	}
337
338
339
	/**
340
	 * Sets a new first address part, e.g. the street name.
341
	 *
342
	 * @param string $address1 New first address part
343
	 */
344
	public function setAddress1( string $address1 )
345
	{
346
		$this->address1 = $address1;
347
	}
348
349
350
	/**
351
	 * Returns the second address part, e.g. the house number.
352
	 *
353
	 * @return string Second address part
354
	 */
355
	public function getAddress2() : string
356
	{
357
		return (string) $this->address2;
358
	}
359
360
361
	/**
362
	 * Sets a new second address part, e.g. the house number.
363
	 *
364
	 * @param string $address2 New second address part
365
	 */
366
	public function setAddress2( string $address2 )
367
	{
368
		$this->address2 = $address2;
369
	}
370
371
372
	/**
373
	 * Returns the third address part, e.g. the house name or floor number.
374
	 *
375
	 * @return string third address part
376
	 */
377
	public function getAddress3() : string
378
	{
379
		return (string) $this->address3;
380
	}
381
382
383
	/**
384
	 * Sets a new third address part, e.g. the house name or floor number.
385
	 *
386
	 * @param string $address3 New third address part
387
	 */
388
	public function setAddress3( string $address3 )
389
	{
390
		$this->address3 = $address3;
391
	}
392
393
394
	/**
395
	 * Returns the postal code.
396
	 *
397
	 * @return string Postal code
398
	 */
399
	public function getPostal() : string
400
	{
401
		return (string) $this->postal;
402
	}
403
404
405
	/**
406
	 * Sets a new postal code.
407
	 *
408
	 * @param string $postal New postal code
409
	 */
410
	public function setPostal( string $postal )
411
	{
412
		$this->postal = $postal;
413
	}
414
415
416
	/**
417
	 * Returns the city name.
418
	 *
419
	 * @return string City name
420
	 */
421
	public function getCity() : string
422
	{
423
		return (string) $this->city;
424
	}
425
426
427
	/**
428
	 * Sets a new city name.
429
	 *
430
	 * @param string $city New city name
431
	 */
432
	public function setCity( string $city )
433
	{
434
		$this->city = $city;
435
	}
436
437
438
	/**
439
	 * Returns the state name.
440
	 *
441
	 * @return string State name
442
	 */
443
	public function getState() : string
444
	{
445
		return (string) $this->state;
446
	}
447
448
449
	/**
450
	 * Sets a new state name.
451
	 *
452
	 * @param string $state New state name
453
	 */
454
	public function setState( string $state )
455
	{
456
		$this->state = $state;
457
	}
458
459
460
	/**
461
	 * Returns the unique ID of the country the address belongs to.
462
	 *
463
	 * @return string Unique ID of the country
464
	 */
465
	public function getCountryId() : string
466
	{
467
		return (string) $this->countryid;
468
	}
469
470
471
	/**
472
	 * Sets the ID of the country the address is in.
473
	 *
474
	 * @param string $countryid Unique ID of the country
475
	 */
476
	public function setCountryId( string $countryid )
477
	{
478
		$this->countryid = strtoupper( $countryid );
479
	}
480
481
482
	/**
483
	 * Returns the unique ID of the language.
484
	 *
485
	 * @return string Unique ID of the language
486
	 */
487
	public function getLanguageId() : string
488
	{
489
		return (string) $this->langid;
490
	}
491
492
493
	/**
494
	 * Sets the ID of the language.
495
	 *
496
	 * @param string $langid Unique ID of the language
497
	 */
498
	public function setLanguageId( string $langid )
499
	{
500
		$this->langid = $langid;
501
	}
502
503
504
	/**
505
	 * Returns the telephone number.
506
	 *
507
	 * @return string Telephone number
508
	 */
509
	public function getTelephone() : string
510
	{
511
		return (string) $this->telephone;
512
	}
513
514
515
	/**
516
	 * Sets a new telephone number.
517
	 *
518
	 * @param string $telephone New telephone number
519
	 */
520
	public function setTelephone( string $telephone )
521
	{
522
		$this->telephone = $telephone;
523
	}
524
525
526
	/**
527
	 * Returns the telefax number.
528
	 *
529
	 * @return string Telefax number
530
	 */
531
	public function getTelefax() : string
532
	{
533
		return (string) $this->telefax;
534
	}
535
536
537
	/**
538
	 * Sets a new telefax number.
539
	 *
540
	 * @param string $telefax New telefax number
541
	 */
542
	public function setTelefax( string $telefax )
543
	{
544
		$this->telefax = $telefax;
545
	}
546
547
548
	/**
549
	 * Returns the mobile number.
550
	 *
551
	 * @return string Mobile number
552
	 */
553
	public function getMobile() : string
554
	{
555
		return (string) $this->mobile;
556
	}
557
558
559
	/**
560
	 * Sets a new mobile number.
561
	 *
562
	 * @param string $mobile New mobile number
563
	 */
564
	public function setMobile( string $mobile )
565
	{
566
		$this->mobile = $mobile;
567
	}
568
569
570
	/**
571
	 * Returns the website URL.
572
	 *
573
	 * @return string Website URL
574
	 */
575
	public function getWebsite() : string
576
	{
577
		return (string) $this->website;
578
	}
579
580
581
	/**
582
	 * Sets a new website URL.
583
	 *
584
	 * @param string $website New website URL
585
	 */
586
	public function setWebsite( string $website )
587
	{
588
		$pattern = '#^([a-z]+://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?(/.*)?$#';
589
590
		if( $website !== '' && preg_match( $pattern, $website ) !== 1 ) {
591
			throw new \Exception( sprintf( 'Invalid web site URL "%1$s"', $website ) );
592
		}
593
594
		$this->website = $website;
595
	}
596
597
598
	/**
599
	 * Returns the longitude.
600
	 *
601
	 * @return float Longitude value
602
	 */
603
	public function getLongitude() : float
604
	{
605
		return (float) $this->longitude;
606
	}
607
608
609
	/**
610
	 * Sets a new longitude.
611
	 *
612
	 * @param float $value New longitude value
613
	 */
614
	public function setLongitude( float $value )
615
	{
616
		$this->longitude = $value;
617
	}
618
619
620
	/**
621
	 * Returns the latitude.
622
	 *
623
	 * @return float Latitude value
624
	 */
625
	public function getLatitude() : float
626
	{
627
		return (float) $this->latitude;
628
	}
629
630
631
	/**
632
	 * Sets a new latitude.
633
	 *
634
	 * @param float $value New latitude value
635
	 */
636
	public function setLatitude( float $value )
637
	{
638
		$this->latitude = $value;
639
	}
640
}
641