MAPG-47 add toArray() method to Bounds
This commit is contained in:
parent
55d5cad40a
commit
8eb3dcf2e2
@ -75,18 +75,23 @@ class Bounds
|
|||||||
return $m * ($a + $c) / 2;
|
return $m * ($a + $c) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toJson(): string
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
if (!$this->initialized) {
|
if (!$this->initialized) {
|
||||||
throw new \Exception("Bounds are not initialized!");
|
throw new \Exception("Bounds are not initialized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return json_encode([
|
return [
|
||||||
'south' => $this->southLat,
|
'south' => $this->southLat,
|
||||||
'west' => $this->westLng,
|
'west' => $this->westLng,
|
||||||
'north' => $this->northLat,
|
'north' => $this->northLat,
|
||||||
'east' => $this->eastLng,
|
'east' => $this->eastLng,
|
||||||
]);
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toJson(): string
|
||||||
|
{
|
||||||
|
return json_encode($this->toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private function initialize(Position $position)
|
private function initialize(Position $position)
|
||||||
|
Loading…
Reference in New Issue
Block a user