public function addPoint(Point $point) { $this->points[] = $point; }
static function fromResponse($arr) { if (!$arr) { return null; } $polygon = new Polygon(); foreach ($arr as $point) { $polygon->addPoint($point["x"], $point["y"]); } return $polygon; }