protected function validateRingValue($ring)
{
switch (true) {
case $ring instanceof AbstractLineString:
$ring = $ring->toArray();
break;
case is_array($ring):
break;
default:
throw new InvalidValueException(sprintf('Invalid %s LineString value of type "%s"', $this->getType(), is_object($ring) ? get_class($ring) : gettype($ring)));
}
$ring = $this->validateLineStringValue($ring);
if ($ring[0] !== end($ring)) {
throw new InvalidValueException(sprintf('Invalid polygon, ring "(%s)" is not closed', $this->toStringLineString($ring)));
}
return $ring;
}