private function assert() { $this->assertDimension($this->getDimension()); $points = $this->getPoints(); $count = count($points); if (1 === $count) { throw InsufficientNumberOfGeometriesException::create(2, $count, 'Point'); } foreach ($points as $point) { $this->assertGeometry($point, 'GeoIO\\Geometry\\Point'); } }
private function assert() { $points = $this->getPoints(); $count = count($points); if ($count > 0 && $count < 4) { throw InsufficientNumberOfGeometriesException::create(4, $count, 'Point'); } $lastPoint = end($points); $firstPoint = reset($points); if ($lastPoint && $firstPoint && ($lastPoint->getX() !== $firstPoint->getX() || $lastPoint->getY() !== $firstPoint->getY() || $lastPoint->getZ() !== $firstPoint->getZ() || $lastPoint->getM() !== $firstPoint->getM())) { throw LinearRingNotClosedException::create(); } }