@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function __construct(array $options = []) |
| 30 | 30 | { |
| 31 | 31 | parent::__construct(); |
| 32 | - if (array_key_exists('location_engine_type',$options)) { |
|
| 32 | + if (array_key_exists('location_engine_type', $options)) { |
|
| 33 | 33 | $this->locationEngineType = $options['location_engine_type']; |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | ), |
| 67 | 67 | 'attributes' => [ |
| 68 | 68 | 'value' => '10', // default distance |
| 69 | - 'data-searchbox' => -1, // hide the search box |
|
| 69 | + 'data-searchbox' => -1, // hide the search box |
|
| 70 | 70 | 'data-allowclear' => 'false', // allow to clear a selected value |
| 71 | 71 | 'data-placeholder' => /*@translate*/ 'Distance', |
| 72 | 72 | ] |
@@ -137,18 +137,18 @@ |
||
| 137 | 137 | * |
| 138 | 138 | * @return $this |
| 139 | 139 | */ |
| 140 | - public function setValue($value, $type=null) |
|
| 140 | + public function setValue($value, $type = null) |
|
| 141 | 141 | { |
| 142 | 142 | if ($value instanceOf Location) { |
| 143 | 143 | $value = $this->getConverter()->toValue($value, $type ?: $this->typeElement->getValue()); |
| 144 | 144 | } |
| 145 | 145 | if ('geo' == $value['type'] && empty($value['data'])) { |
| 146 | 146 | $lonLat = $this->getConverter()->toCoordinates($value['name']); |
| 147 | - foreach($lonLat as $k=>$v) { |
|
| 148 | - list($lon,$lat) = explode(',', $v, 2); |
|
| 149 | - $latLon[]=$lat.','.$lon; |
|
| 147 | + foreach ($lonLat as $k=>$v) { |
|
| 148 | + list($lon, $lat) = explode(',', $v, 2); |
|
| 149 | + $latLon[] = $lat . ',' . $lon; |
|
| 150 | 150 | } |
| 151 | - $value['data'] = ['coordinates'=>[ (float) $lat, (float) $lon] ,'type'=>'Point', 'region' => '' ,'postalcode' =>'', 'country' => 'DE']; |
|
| 151 | + $value['data'] = ['coordinates'=>[(float) $lat, (float) $lon], 'type'=>'Point', 'region' => '', 'postalcode' =>'', 'country' => 'DE']; |
|
| 152 | 152 | } |
| 153 | 153 | if (!is_array($value)) { |
| 154 | 154 | $value = explode('|', $value, 2); |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | public function toCoordinates($input) { |
| 99 | 99 | $client = new Client('http://api.cross-solution.de/geo'); |
| 100 | 100 | $client->setMethod('GET'); |
| 101 | - $client->setParameterGet(array('q' => $input, 'country' => 'DE', 'coor' => 1, 'zoom' => 1 , 'strict' => 0)); |
|
| 101 | + $client->setParameterGet(array('q' => $input, 'country' => 'DE', 'coor' => 1, 'zoom' => 1, 'strict' => 0)); |
|
| 102 | 102 | $response = $client->send(); |
| 103 | 103 | $result = $response->getBody(); |
| 104 | 104 | $result = json_decode($result); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $client->setMethod('GET'); |
| 28 | 28 | |
| 29 | 29 | $osmTags = [ |
| 30 | - 'tourism','aeroway','railway', 'amenity', 'historic', 'tunnel', 'mountain_pass', |
|
| 30 | + 'tourism', 'aeroway', 'railway', 'amenity', 'historic', 'tunnel', 'mountain_pass', |
|
| 31 | 31 | 'leisure', 'natural', 'bridge', 'waterway' |
| 32 | 32 | ]; |
| 33 | 33 | |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | $result = $response->getBody(); |
| 49 | 49 | $result = json_decode($result); |
| 50 | 50 | $result = $result->features; |
| 51 | - $r=[]; |
|
| 51 | + $r = []; |
|
| 52 | 52 | foreach ($result as $key => $val) { |
| 53 | - $row=['name' => (property_exists($val->properties, 'name') ? $val->properties->name:''), |
|
| 54 | - 'postcode' => (property_exists($val->properties, 'postcode') ? $val->properties->postcode:''), |
|
| 55 | - 'city' =>(property_exists($val->properties, 'city') ? $val->properties->city:''), |
|
| 53 | + $row = ['name' => (property_exists($val->properties, 'name') ? $val->properties->name : ''), |
|
| 54 | + 'postcode' => (property_exists($val->properties, 'postcode') ? $val->properties->postcode : ''), |
|
| 55 | + 'city' =>(property_exists($val->properties, 'city') ? $val->properties->city : ''), |
|
| 56 | 56 | 'street' => (property_exists($val->properties, 'street') ? $val->properties->street : ''), |
| 57 | 57 | 'state' => (property_exists($val->properties, 'state') ? $val->properties->state : ''), |
| 58 | 58 | 'country' => (property_exists($val->properties, 'country') ? $val->properties->country : ''), |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | 'osm_id' => (property_exists($val->properties, 'osm_id') ? $val->properties->osm_id : ''), |
| 63 | 63 | 'data' => json_encode($val), |
| 64 | 64 | ]; |
| 65 | - $r[]=$row; |
|
| 65 | + $r[] = $row; |
|
| 66 | 66 | } |
| 67 | 67 | return $r; |
| 68 | 68 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $query = $this->params()->fromQuery(); |
| 48 | 48 | |
| 49 | - switch($this->plugin){ |
|
| 49 | + switch ($this->plugin) { |
|
| 50 | 50 | case 'photon': |
| 51 | 51 | /* @var Plugin\Photon $geoApi */ |
| 52 | 52 | $geoApi = $this->getPluginManager()->get('geo/photon'); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | $result = array(); |
| 62 | 62 | if (!empty($query['q'])) { |
| 63 | - $result = $geoApi($query['q'], $this->geoCoderUrl, $this->params('lang','de')); |
|
| 63 | + $result = $geoApi($query['q'], $this->geoCoderUrl, $this->params('lang', 'de')); |
|
| 64 | 64 | } |
| 65 | 65 | $viewModel = new JsonModel($result); |
| 66 | 66 | return $viewModel; |