You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
447 B

6 days ago
6 days ago
  1. <?php
  2. namespace OSM;
  3. use OSM\Element\Element;
  4. class OSM
  5. {
  6. public array $elements = [];
  7. public static function createFromJson($json)
  8. {
  9. $array = json_decode($json, true);
  10. $instance = new self();
  11. $items = $array['elements'];
  12. foreach ($items as $item) {
  13. $element = Element::createFromArray($item);
  14. $instance->elements[] = $element;
  15. }
  16. return $instance;
  17. }
  18. }