예제 #1
0
 public static function fromString($wktArgument)
 {
     $pairs = explode(',', trim($wktArgument));
     $points = array_map(function ($pair) {
         return Point::fromPair($pair);
     }, $pairs);
     return new static($points);
 }
예제 #2
0
 public static function fromString($wktArgument)
 {
     $matches = [];
     preg_match_all('/\\(\\s*(\\d+\\s+\\d+)\\s*\\)/', trim($wktArgument), $matches);
     if (count($matches) < 2) {
         return new static([]);
     }
     $points = array_map(function ($pair) {
         return Point::fromPair($pair);
     }, $matches[1]);
     return new static($points);
 }