@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $queryParams = array_intersect_ukey( |
| 56 | 56 | $request->requestVars(), |
| 57 | 57 | $config['searchable_fields'], |
| 58 | - function ($a, $b) { |
|
| 58 | + function($a, $b) { |
|
| 59 | 59 | $a = explode(':', $a)[0]; |
| 60 | 60 | $b = explode(':', $b)[0]; |
| 61 | 61 | return strcmp($a, $b); |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | private static $type_map = [ |
| 17 | 17 | 'Varchar' => 'string', |
| 18 | - 'Float' => 'decimal', // key tbc |
|
| 19 | - 'Datetime' => 'dateTime', // key tbc |
|
| 20 | - 'Int' => 'integer', // key tbc |
|
| 18 | + 'Float' => 'decimal', // key tbc |
|
| 19 | + 'Datetime' => 'dateTime', // key tbc |
|
| 20 | + 'Int' => 'integer', // key tbc |
|
| 21 | 21 | ]; |
| 22 | 22 | |
| 23 | 23 | private static $ns = 'ssgis=https://github.com/smindel/silverstripe-gis'; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | list($nsName, $nsUri) = explode('=', $config['ns']); |
| 81 | 81 | |
| 82 | - $dom = new DOMDocument('1.0','UTF-8'); |
|
| 82 | + $dom = new DOMDocument('1.0', 'UTF-8'); |
|
| 83 | 83 | $schema = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'schema'); |
| 84 | 84 | $schema->setAttribute('elementFormDefault', 'qualified'); |
| 85 | 85 | $schema->setAttribute('targetNamespace', $nsUri); |
@@ -157,13 +157,13 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | list($nsName, $nsUri) = explode('=', $config['ns']); |
| 159 | 159 | |
| 160 | - $dom = new DOMDocument('1.0','UTF-8'); |
|
| 160 | + $dom = new DOMDocument('1.0', 'UTF-8'); |
|
| 161 | 161 | |
| 162 | 162 | $featureCollection = $dom->createElement('FeatureCollection'); |
| 163 | 163 | $featureCollection->setAttribute('xmlns:gml', 'http://www.opengis.net/gml'); |
| 164 | 164 | $featureCollection->setAttribute('xmlns:' . $nsName, $nsUri); |
| 165 | 165 | |
| 166 | - foreach($list as $item) { |
|
| 166 | + foreach ($list as $item) { |
|
| 167 | 167 | if (!$item->canView()) { |
| 168 | 168 | continue; |
| 169 | 169 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $line = $dom->createElement('gml:LineString'); |
| 223 | 223 | $line->setAttribute('srsName', 'urn:ogc:def:crs:EPSG::' . $gis->srid); |
| 224 | 224 | |
| 225 | - $posList = $dom->createElement('gml:posList', implode(' ', array_map(function($point){return implode(' ', $point);}, $gis->coordinates))); |
|
| 225 | + $posList = $dom->createElement('gml:posList', implode(' ', array_map(function($point) {return implode(' ', $point); }, $gis->coordinates))); |
|
| 226 | 226 | |
| 227 | 227 | $line->appendChild($posList); |
| 228 | 228 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | $linearRing = $dom->createElement('gml:LinearRing'); |
| 241 | 241 | |
| 242 | - $posList = $dom->createElement('gml:posList', implode(' ', array_map(function($point){return implode(' ', $point);}, $ring))); |
|
| 242 | + $posList = $dom->createElement('gml:posList', implode(' ', array_map(function($point) {return implode(' ', $point); }, $ring))); |
|
| 243 | 243 | |
| 244 | 244 | $linearRing->appendChild($posList); |
| 245 | 245 | |
@@ -6,7 +6,9 @@ |
||
| 6 | 6 | use SilverStripe\ORM\DB; |
| 7 | 7 | use Smindel\GIS\GIS; |
| 8 | 8 | |
| 9 | -if (!class_exists(SQLite3SchemaManager::class)) return; |
|
| 9 | +if (!class_exists(SQLite3SchemaManager::class)) { |
|
| 10 | + return; |
|
| 11 | +} |
|
| 10 | 12 | |
| 11 | 13 | class SQLite3GISSchemaManager extends SQLite3SchemaManager |
| 12 | 14 | { |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | if (preg_match(self::EWKT_PATTERN, $this->value, $matches)) { |
| 135 | 135 | $geometries = preg_split('/,(?=[a-zA-Z])/', substr($matches[4], 1, -1)); |
| 136 | 136 | $srid = $this->srid; |
| 137 | - return array_map(function ($geometry) use ($srid) { |
|
| 137 | + return array_map(function($geometry) use ($srid) { |
|
| 138 | 138 | return GIS::create('SRID=' . $srid . ';' . $geometry); |
| 139 | 139 | }, $geometries); |
| 140 | 140 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | protected static function reproject_array($coordinates, $fromProj, $toProj) |
| 241 | 241 | { |
| 242 | - return self::each($coordinates, function ($coordinate) use ($fromProj, $toProj) { |
|
| 242 | + return self::each($coordinates, function($coordinate) use ($fromProj, $toProj) { |
|
| 243 | 243 | return array_slice(self::$proj4->transform($toProj, new Point($coordinate[0], $coordinate[1], $fromProj))->toArray(), 0, 2); |
| 244 | 244 | }); |
| 245 | 245 | } |
@@ -70,9 +70,9 @@ |
||
| 70 | 70 | 'coordinates' => $geometry->coordinates, |
| 71 | 71 | ]; |
| 72 | 72 | } |
| 73 | - $feature['geometry']['geometries'] = $geometries; |
|
| 73 | + $feature['geometry']['geometries'] = $geometries; |
|
| 74 | 74 | } else { |
| 75 | - $feature['geometry']['coordinates'] = $geo->coordinates; |
|
| 75 | + $feature['geometry']['coordinates'] = $geo->coordinates; |
|
| 76 | 76 | } |
| 77 | 77 | echo json_encode($feature); |
| 78 | 78 | } |