/**
  * Sets the marker shape coordinates.
  *
  * @param array $coordinates The marker shape coordinates.
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the coordinates are not valid according to the type.
  */
 public function setCoordinates(array $coordinates)
 {
     switch (strtolower($this->type)) {
         case 'circle':
             if (count($coordinates) === 3 && is_numeric($coordinates[0]) && is_numeric($coordinates[1]) && is_numeric($coordinates[2])) {
                 $this->coordinates = $coordinates;
             } else {
                 throw OverlayException::invalidMarkerShapeCircleCoordinates();
             }
             break;
         case 'poly':
             if (count($coordinates) <= 0 || count($coordinates) % 2 !== 0) {
                 throw OverlayException::invalidMarkerShapePolyCoordinates();
             }
             foreach ($coordinates as $coordinate) {
                 if (!is_numeric($coordinate)) {
                     throw OverlayException::invalidMarkerShapePolyCoordinates();
                 }
             }
             $this->coordinates = $coordinates;
             break;
         case 'rect':
             if (count($coordinates) === 4 && is_numeric($coordinates[0]) && is_numeric($coordinates[1]) && is_numeric($coordinates[2]) && is_numeric($coordinates[3])) {
                 $this->coordinates = $coordinates;
             } else {
                 throw OverlayException::invalidMarkerShapeRectCoordinates();
             }
             break;
     }
 }