public function toArray() { $points = []; foreach ($this as $point) { $points[] = $point->toArray(); } return ['points' => $points]; }