1 | <?php |
||
18 | trait TBillingAddress |
||
19 | { |
||
20 | /** @var array */ |
||
21 | protected $billingLines; |
||
22 | /** @var string */ |
||
23 | protected $billingCity; |
||
24 | /** @var string */ |
||
25 | protected $billingMainDivision; |
||
26 | /** @var string */ |
||
27 | protected $billingCountryCode; |
||
28 | /** @var string */ |
||
29 | protected $billingPostalCode; |
||
30 | |||
31 | public function getBillingLines() |
||
35 | |||
36 | public function setBillingLines($lines) |
||
41 | |||
42 | /** |
||
43 | * Make sure we have max 4 address lines of 70 chars max |
||
44 | * |
||
45 | * If there are more than 4 lines concatenate all extra lines with the 4th line. |
||
46 | * |
||
47 | * Truncate any lines to 70 chars max. |
||
48 | * |
||
49 | * @param string $lines |
||
50 | * @return array or null |
||
51 | */ |
||
52 | abstract protected function cleanAddressLines($lines); |
||
53 | |||
54 | /** |
||
55 | * Aggregate the billing address lines into the BillingAddress node |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | protected function serializeBillingAddress() |
||
82 | |||
83 | public function getBillingCity() |
||
87 | |||
88 | public function setBillingCity($city) |
||
93 | |||
94 | public function getBillingMainDivision() |
||
98 | |||
99 | public function setBillingMainDivision($div) |
||
104 | |||
105 | public function getBillingCountryCode() |
||
109 | |||
110 | public function setBillingCountryCode($code) |
||
116 | |||
117 | public function getBillingPostalCode() |
||
121 | |||
122 | public function setBillingPostalCode($code) |
||
127 | |||
128 | /** |
||
129 | * Trim any white space and return the resulting string truncating to $maxLength. |
||
130 | * |
||
131 | * Return null if the result is an empty string or not a string |
||
132 | * |
||
133 | * @param string $string |
||
134 | * @param int $maxLength |
||
135 | * @return string or null |
||
136 | */ |
||
137 | abstract protected function cleanString($string, $maxLength); |
||
138 | |||
139 | /** |
||
140 | * Serialize an optional element containing a string. The value will be |
||
141 | * xml-encoded if is not null. |
||
142 | * |
||
143 | * @param string |
||
144 | * @param string |
||
145 | * @return string |
||
146 | */ |
||
147 | abstract protected function serializeOptionalXmlEncodedValue($name, $value); |
||
148 | |||
149 | /** |
||
150 | * encode the passed in string to be safe for xml if it is not null, |
||
151 | * otherwise simply return the null parameter. |
||
152 | * |
||
153 | * @param string|null |
||
154 | * @return string|null |
||
155 | */ |
||
156 | abstract protected function xmlEncode($value = null); |
||
157 | } |
||
158 |