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
449 B

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