@@ -44,9 +44,13 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public static function to_ewkt($geo) |
| 46 | 46 | { |
| 47 | - if (is_string($geo)) return $geo; |
|
| 47 | + if (is_string($geo)) { |
|
| 48 | + return $geo; |
|
| 49 | + } |
|
| 48 | 50 | |
| 49 | - if ($geo instanceof DBGeography) $geo = $geo->getValue(); |
|
| 51 | + if ($geo instanceof DBGeography) { |
|
| 52 | + $geo = $geo->getValue(); |
|
| 53 | + } |
|
| 50 | 54 | |
| 51 | 55 | $type = isset($geo['type']) ? strtoupper($geo['type']) : null; |
| 52 | 56 | $srid = isset($geo['srid']) ? $geo['srid'] : Config::inst()->get(self::class, 'default_srid'); |
@@ -80,10 +84,14 @@ discard block |
||
| 80 | 84 | |
| 81 | 85 | public static function to_array($geo) |
| 82 | 86 | { |
| 83 | - if ($geo instanceof DBGeography) return $geo->getValue(); |
|
| 87 | + if ($geo instanceof DBGeography) { |
|
| 88 | + return $geo->getValue(); |
|
| 89 | + } |
|
| 84 | 90 | |
| 85 | 91 | if (is_array($geo)) { |
| 86 | - if (isset($geo['coordinates'])) return $geo; |
|
| 92 | + if (isset($geo['coordinates'])) { |
|
| 93 | + return $geo; |
|
| 94 | + } |
|
| 87 | 95 | switch (true) { |
| 88 | 96 | case is_numeric($geo[0]): $type = 'Point'; break; |
| 89 | 97 | case is_numeric($geo[0][0]): $type = 'LineString'; break; |