| 1 | <?php |
||
| 18 | class Address implements AddressInterface |
||
| 19 | { |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | private $address; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var string|null |
||
| 28 | */ |
||
| 29 | private $name; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Address |
||
| 33 | * |
||
| 34 | * @param $address |
||
| 35 | * @param null $name |
||
| 36 | * |
||
| 37 | */ |
||
| 38 | 16 | public function __construct($address, $name = null) |
|
| 43 | |||
| 44 | /** |
||
| 45 | * Gets the e-mail address |
||
| 46 | * |
||
| 47 | * @return string |
||
| 48 | */ |
||
| 49 | 16 | public function getAddress() |
|
| 53 | |||
| 54 | /** |
||
| 55 | * Gets the name |
||
| 56 | * |
||
| 57 | * @return null|string |
||
| 58 | */ |
||
| 59 | 16 | public function getName() |
|
| 63 | |||
| 64 | /** |
||
| 65 | * Gets the string representation of this e-mail address |
||
| 66 | * |
||
| 67 | * @return string |
||
| 68 | */ |
||
| 69 | 16 | public function toString() |
|
| 77 | |||
| 78 | /** |
||
| 79 | * An automated alias for toString() method |
||
| 80 | * |
||
| 81 | * @see Address::toString() |
||
| 82 | * |
||
| 83 | * @return string |
||
| 84 | */ |
||
| 85 | 16 | public function __toString() |
|
| 89 | } |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: