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);
    }
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);
    }
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 ) ; }
Returns the center coordinates of an array of Markers

@param Marker[] $markers

@throws \yii\base\InvalidParamException
@return LatLng|null
Returns the center coordinates of an array of Markers