run.php
15 lines
| 1 | <?php |
| 2 | require_once __DIR__ . '/../src/JsonMapper.php'; |
| 3 | require_once 'Contact.php'; |
| 4 | require_once 'Address.php'; |
| 5 | |
| 6 | $json = json_decode(file_get_contents(__DIR__ . '/single.json')); |
| 7 | |
| 8 | $mapper = new JsonMapper(); |
| 9 | $contact = $mapper->map($json, new Contact()); |
| 10 | |
| 11 | $coords = $contact->address->getGeoCoords(); |
| 12 | |
| 13 | echo $contact->name . ' lives at coordinates ' |
| 14 | . $coords['lat'] . ',' . $coords['lon'] . "\n"; |
| 15 | ?> |