code: public function toArray()
      {
          $data = [];
          foreach ($this->points as $point) {
              $data[] = $point->toArray();
          }
          return $data;
      }
docs: Exports the internal state to an array
  @return array