Esempio n. 1
0
 /**
  * Creates a LatLngBounds object from a string representation of ((Lat, Lng), (Lat, Lng)) values. For example:
  *
  * ```
  *  ((48.82415805606007,2.308330535888672),(48.867086142850226,2.376995086669922))
  * ```
  *
  * @param string $string the coordinates representation of boundaries
  * @return LatLngBounds|null
  */
 public static function createFromString($string)
 {
     preg_match('/\\(\\((.*?)\\), \\((.*?)\\)\\)/', $string, $matches);
     if (count($matches) == 3) {
         $sw = LatLng::createFromString($matches[1]);
         $ne = LatLng::createFromString($matches[2]);
         if (!is_null($sw) && !is_null($ne)) {
             return new self(['southWest' => $sw, 'northEast' => $ne]);
         }
     }
     return null;
 }