| 1 | <?php |
||
| 10 | class ConvertAddressToContactAdress |
||
| 11 | { |
||
| 12 | protected $baseAddressProperties = [ |
||
| 13 | 'label', |
||
| 14 | 'street', |
||
| 15 | 'street2', |
||
| 16 | 'city', |
||
| 17 | 'postalCode', |
||
| 18 | 'country', |
||
| 19 | 'organization', |
||
| 20 | 'region', |
||
| 21 | 'regionText', |
||
| 22 | 'namePrefix', |
||
| 23 | 'firstName', |
||
| 24 | 'middleName', |
||
| 25 | 'lastName', |
||
| 26 | 'nameSuffix', |
||
| 27 | 'types', |
||
| 28 | 'primary' |
||
| 29 | ]; |
||
| 30 | |||
| 31 | public function __construct() |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param Address $customerAddress |
||
| 38 | * |
||
| 39 | * @return ContactAddress |
||
| 40 | */ |
||
| 41 | public function convert(Address $customerAddress) |
||
| 54 | } |
||
| 55 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: