Exemplo n.º 1
0
 /**
  * Returns the center coordinates of an array of Markers
  *
  * @param Marker[] $markers
  *
  * @return LatLng|null
  * @throws \yii\base\InvalidParamException
  */
 public static function getCenterOfMarkers($markers)
 {
     $coords = [];
     foreach ($markers as $marker) {
         if (!$marker instanceof Marker) {
             throw new InvalidParamException('$markers must be an array of "' . self::className() . '" objects');
         }
         $coords[] = $marker->position;
     }
     return LatLng::getCenterOfCoordinates($coords);
 }