points[] = $point; } } return $this; } public function getFirstPoint(): Point { return reset($this->points); } public function getLastPoint(): Point { return end($this->points); } public function reversePoints(): static { $this->points = array_reverse($this->points); return $this; } }