1 | <?php |
||
8 | class StructuredPostalAddress implements PostalAddressInterface |
||
9 | { |
||
10 | /** |
||
11 | * @var string|null |
||
12 | */ |
||
13 | protected $street; |
||
14 | |||
15 | /** |
||
16 | * @var string|null |
||
17 | */ |
||
18 | protected $buildingNo; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $postCode; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $town; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $country; |
||
34 | |||
35 | /** |
||
36 | * Constructor |
||
37 | * |
||
38 | * @param string|null $street Street name or null |
||
39 | * @param string|null $buildingNo Building number or null |
||
40 | * @param string $postCode Postal code |
||
41 | * @param string $town Town name |
||
42 | * @param string $country Country code (ISO 3166-1 alpha-2) |
||
43 | * |
||
44 | * @throws \InvalidArgumentException When the address contains invalid characters or is too long. |
||
45 | */ |
||
46 | 3 | public function __construct($street, $buildingNo, $postCode, $town, $country = 'CH') |
|
54 | |||
55 | /** |
||
56 | * Creates a new instance after sanitizing all inputs |
||
57 | * |
||
58 | * @param string|null $street Street name or null |
||
59 | * @param string|null $buildingNo Building number or null |
||
60 | * @param string $postCode Postal code |
||
61 | * @param string $town Town name |
||
62 | * @param string $country Country code (ISO 3166-1 alpha-2) |
||
63 | * |
||
64 | * @return StructuredPostalAddress |
||
65 | */ |
||
66 | 1 | public static function sanitize($street, $buildingNo, $postCode, $town, $country = 'CH') |
|
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | */ |
||
80 | 2 | public function asDom(\DOMDocument $doc) |
|
96 | } |
||
97 |