1
|
|
|
<?php |
2
|
|
|
namespace Germania\Addresses; |
3
|
|
|
|
4
|
|
|
class Address extends AddressAbstract implements AddressInterface, AddressProviderInterface |
5
|
|
|
{ |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @inheritDoc |
9
|
|
|
*/ |
10
|
10 |
|
public function getAddress() : ?AddressInterface |
11
|
|
|
{ |
12
|
10 |
|
return $this; |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @param string $type|null |
|
|
|
|
18
|
|
|
* @return self Fluent interface |
19
|
|
|
*/ |
20
|
14 |
|
public function setType(?string $type) : self |
21
|
|
|
{ |
22
|
14 |
|
$this->type = $type; |
23
|
14 |
|
return $this; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param string $street1|null |
|
|
|
|
29
|
|
|
* @return self Fluent interface |
30
|
|
|
*/ |
31
|
32 |
|
public function setStreet1(?string $street1) : self |
32
|
|
|
{ |
33
|
32 |
|
$this->street1 = $street1; |
34
|
32 |
|
return $this; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param string $street2|null |
|
|
|
|
40
|
|
|
* @return self Fluent interface |
41
|
|
|
*/ |
42
|
32 |
|
public function setStreet2(?string $street2) : self |
43
|
|
|
{ |
44
|
32 |
|
$this->street2 = $street2; |
45
|
32 |
|
return $this; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param string $zip|null |
|
|
|
|
51
|
|
|
* @return self Fluent interface |
52
|
|
|
*/ |
53
|
32 |
|
public function setZip(?string $zip) : self |
54
|
|
|
{ |
55
|
32 |
|
$this->zip = $zip; |
56
|
32 |
|
return $this; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param string $location|null |
|
|
|
|
62
|
|
|
* @return self Fluent interface |
63
|
|
|
*/ |
64
|
32 |
|
public function setLocation(?string $location) : self |
65
|
|
|
{ |
66
|
32 |
|
$this->location = $location; |
67
|
32 |
|
return $this; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param string $country|null |
|
|
|
|
73
|
|
|
* @return self Fluent interface |
74
|
|
|
*/ |
75
|
14 |
|
public function setCountry(?string $country) : self |
76
|
|
|
{ |
77
|
14 |
|
$this->country = $country; |
78
|
14 |
|
return $this; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return inheritDoc |
83
|
|
|
*/ |
84
|
20 |
|
public function isEmpty() : bool { |
85
|
20 |
|
return (empty( trim($this->street1) ) |
86
|
20 |
|
and empty( trim($this->street2) ) |
87
|
20 |
|
and empty( trim($this->zip) ) |
88
|
20 |
|
and empty( trim($this->location) )); |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.