Passed
Branch master (95796a)
by Andreas
38:22
created
lib/org/routamc/positioning/exec/import-cities.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     'modification date'=> 18, // date of last modification in yyyy-MM-dd format
27 27
 );
28 28
 
29
-if (   array_key_exists('cities_file_path', $_POST)
29
+if (array_key_exists('cities_file_path', $_POST)
30 30
     && file_exists($_POST['cities_file_path']))
31 31
 {
32 32
     $features = explode(',', $_POST['featurecodes_to_import']);
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $row++;
48 48
         //if ($row > 1000) { break; }
49 49
 
50
-        if (   !isset($data[$fields_map['featurecode']])
50
+        if (!isset($data[$fields_map['featurecode']])
51 51
             || !in_array($data[$fields_map['featurecode']], $features))
52 52
         {
53 53
             continue;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             $new_city->alternatenames .= '|';
87 87
         }
88 88
 
89
-        if (   array_key_exists("{$new_city->country}:{$data[3]}:{$new_city->city}", $imported_cities)
89
+        if (array_key_exists("{$new_city->country}:{$data[3]}:{$new_city->city}", $imported_cities)
90 90
             || $row == 1)
91 91
         {
92 92
             // We have city by this name for the country already
Please login to merge, or discard this patch.
lib/org/routamc/positioning/dm2/widget.php 1 patch
Spacing   +32 added lines, -42 removed lines patch added patch discarded remove patch
@@ -105,8 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
         if (is_null($this->enabled_methods))
107 107
         {
108
-            $this->enabled_methods = array
109
-            (
108
+            $this->enabled_methods = array(
110 109
                 'place',
111 110
                 'map',
112 111
                 'coordinates'
@@ -138,8 +137,7 @@  discard block
 block discarded – undo
138 137
         $this->_get_country_list();
139 138
         $this->_init_widgets_js_options();
140 139
 
141
-        $this->_allowed_xep_keys = array
142
-        (
140
+        $this->_allowed_xep_keys = array(
143 141
             'area',
144 142
             'building',
145 143
             'description',
@@ -164,11 +162,11 @@  discard block
 block discarded – undo
164 162
         $html = "<div id=\"{$this->_element_id}\" class=\"midcom_helper_datamanager2_widget_position\"><!-- widget starts -->\n";
165 163
 
166 164
         $input_key = $this->_get_input_key("id");
167
-        $html .= "<input class=\"position_widget_id\" id=\"{$this->_element_id}_id\" name=\"".$input_key."\" type=\"hidden\" value=\"{$this->_element_id}\" />";
165
+        $html .= "<input class=\"position_widget_id\" id=\"{$this->_element_id}_id\" name=\"" . $input_key . "\" type=\"hidden\" value=\"{$this->_element_id}\" />";
168 166
         $input_key = $this->_get_input_key("backend_url");
169
-        $html .= "<input class=\"position_widget_backend_url\" id=\"{$this->_element_id}_backend_url\" name=\"".$input_key."\" type=\"hidden\" value=\"{$this->_handler_url}\" />";
167
+        $html .= "<input class=\"position_widget_backend_url\" id=\"{$this->_element_id}_backend_url\" name=\"" . $input_key . "\" type=\"hidden\" value=\"{$this->_handler_url}\" />";
170 168
         $input_key = $this->_get_input_key("backend_service");
171
-        $html .= "<input class=\"position_widget_backend_service\" id=\"{$this->_element_id}_backend_service\" name=\"".$input_key."\" type=\"hidden\" value=\"{$this->service}\" />";
169
+        $html .= "<input class=\"position_widget_backend_service\" id=\"{$this->_element_id}_backend_service\" name=\"" . $input_key . "\" type=\"hidden\" value=\"{$this->service}\" />";
172 170
 
173 171
         $html .= "    <ul>\n";
174 172
 
@@ -178,8 +176,7 @@  discard block
 block discarded – undo
178 176
         }
179 177
 
180 178
         $html .= "    </ul>\n";
181
-        $this->_widget_elements[] = $this->_form->createElement
182
-        (
179
+        $this->_widget_elements[] = $this->_form->createElement(
183 180
             'static',
184 181
             "{$this->_element_id}_static_widget_start",
185 182
             '',
@@ -193,16 +190,14 @@  discard block
 block discarded – undo
193 190
         }
194 191
 
195 192
         $html = "</div><!-- widget ends -->\n";
196
-        $this->_widget_elements[] = $this->_form->createElement
197
-        (
193
+        $this->_widget_elements[] = $this->_form->createElement(
198 194
             'static',
199 195
             "{$this->_element_id}_static_widget_end",
200 196
             '',
201 197
             $html
202 198
         );
203 199
 
204
-        $this->_main_group = $this->_form->addGroup
205
-        (
200
+        $this->_main_group = $this->_form->addGroup(
206 201
             $this->_widget_elements,
207 202
             $this->name,
208 203
             $this->_translate($this->_field['title']),
@@ -218,7 +213,7 @@  discard block
 block discarded – undo
218 213
         {
219 214
             $value = $value_input;
220 215
         }
221
-        if (   !$value
216
+        if (!$value
222 217
             && isset($this->input_defaults[$fieldname]))
223 218
         {
224 219
             $value = $this->input_defaults[$fieldname];
@@ -246,8 +241,7 @@  discard block
 block discarded – undo
246 241
 
247 242
         $html .= "\n</div><!-- tab_content_place ends -->\n";
248 243
 
249
-        $this->_widget_elements[] = $this->_form->createElement
250
-        (
244
+        $this->_widget_elements[] = $this->_form->createElement(
251 245
             'static',
252 246
             "{$this->_element_id}_static_place",
253 247
             '',
@@ -264,7 +258,7 @@  discard block
 block discarded – undo
264 258
         $input_key = $this->_get_input_key($fieldname);
265 259
         $html = "<label for='{$this->_element_id}_input_place_{$fieldname}' id='{$this->_element_id}_input_place_{$fieldname}_label'>";
266 260
         $html .= "<span class=\"field_text\">" . midcom::get()->i18n->get_string("xep_{$fieldname}", 'org.routamc.positioning') . "</span><span class=\"proposal\"></span>";
267
-        $html .= "<input size=\"40\" class=\"shorttext position_widget_input position_widget_input_place_{$fieldname}\" id=\"{$this->_element_id}_input_place_{$fieldname}\" name=\"".$input_key."\" type=\"text\" value=\"{$value}\" />";
261
+        $html .= "<input size=\"40\" class=\"shorttext position_widget_input position_widget_input_place_{$fieldname}\" id=\"{$this->_element_id}_input_place_{$fieldname}\" name=\"" . $input_key . "\" type=\"text\" value=\"{$value}\" />";
268 262
         $html .= "</label>";
269 263
         return $html;
270 264
     }
@@ -284,13 +278,13 @@  discard block
 block discarded – undo
284 278
             }
285 279
         }
286 280
 
287
-        if (   !$city_id
281
+        if (!$city_id
288 282
             && isset($this->input_defaults['city'])
289 283
             && is_numeric($this->input_defaults['city']))
290 284
         {
291 285
             $city_id = $this->input_defaults['city'];
292 286
         }
293
-        if (   !$city_name
287
+        if (!$city_name
294 288
             && isset($this->input_defaults['city'])
295 289
             && is_string($this->input_defaults['city']))
296 290
         {
@@ -304,7 +298,7 @@  discard block
 block discarded – undo
304 298
                 $city = new org_routamc_positioning_city_dba($city_id);
305 299
                 $city_name = $city->city;
306 300
             }
307
-            catch (midcom_error $e){}
301
+            catch (midcom_error $e) {}
308 302
         }
309 303
         return $city_name;
310 304
     }
@@ -316,7 +310,7 @@  discard block
 block discarded – undo
316 310
 
317 311
         foreach ($this->_allowed_xep_keys as $xep_key)
318 312
         {
319
-            if (   !in_array($xep_key, $this->use_xep_keys)
313
+            if (!in_array($xep_key, $this->use_xep_keys)
320 314
                 || !midcom::get()->dbfactory->property_exists($this->_type->location, $xep_key)
321 315
                 || in_array($xep_key, $inserted_xep_keys))
322 316
             {
@@ -342,8 +336,7 @@  discard block
 block discarded – undo
342 336
 
343 337
         $html .= "\n</div><!-- tab_content_map ends -->\n";
344 338
 
345
-        $this->_widget_elements[] = $this->_form->createElement
346
-        (
339
+        $this->_widget_elements[] = $this->_form->createElement(
347 340
             'static',
348 341
             "{$this->_element_id}_static_map",
349 342
             '',
@@ -381,19 +374,18 @@  discard block
 block discarded – undo
381 374
         $input_key = $this->_get_input_key("latitude");
382 375
         $html .= "<label for='{$this->_element_id}_input_coordinates_latitude' id='{$this->_element_id}_input_coordinates_latitude_label'>";
383 376
         $html .= "<span class=\"field_text\">" . midcom::get()->i18n->get_string('latitude', 'org.routamc.positioning') . "</span>";
384
-        $html .= "<input size=\"20\" class=\"shorttext position_widget_input position_widget_input_coordinates_latitude\" id=\"{$this->_element_id}_input_coordinates_latitude\" name=\"".$input_key."\" type=\"text\" value=\"{$lat}\" />";
377
+        $html .= "<input size=\"20\" class=\"shorttext position_widget_input position_widget_input_coordinates_latitude\" id=\"{$this->_element_id}_input_coordinates_latitude\" name=\"" . $input_key . "\" type=\"text\" value=\"{$lat}\" />";
385 378
         $html .= "</label>";
386 379
 
387 380
         $input_key = $this->_get_input_key("longitude");
388 381
         $html .= "<label for='{$this->_element_id}_input_coordinates_longitude' id='{$this->_element_id}_input_coordinates_longitude_label'>";
389 382
         $html .= "<span class=\"field_text\">" . midcom::get()->i18n->get_string('longitude', 'org.routamc.positioning') . "</span>";
390
-        $html .= "<input size=\"20\" class=\"shorttext position_widget_input position_widget_input_coordinates_longitude\" id=\"{$this->_element_id}_input_coordinates_longitude\" name=\"".$input_key."\" type=\"text\" value=\"{$lon}\" />";
383
+        $html .= "<input size=\"20\" class=\"shorttext position_widget_input position_widget_input_coordinates_longitude\" id=\"{$this->_element_id}_input_coordinates_longitude\" name=\"" . $input_key . "\" type=\"text\" value=\"{$lon}\" />";
391 384
         $html .= "</label>";
392 385
 
393 386
         $html .= "\n</div><!-- tab_content_coordinates ends -->\n";
394 387
 
395
-        $this->_widget_elements[] = $this->_form->createElement
396
-        (
388
+        $this->_widget_elements[] = $this->_form->createElement(
397 389
             'static',
398 390
             "{$this->_element_id}_static_coordinates",
399 391
             '',
@@ -403,8 +395,7 @@  discard block
 block discarded – undo
403 395
 
404 396
     public function _get_country_list()
405 397
     {
406
-        $this->_countrylist = array
407
-        (
398
+        $this->_countrylist = array(
408 399
             '' => midcom::get()->i18n->get_string('select your country', 'org.routamc.positioning'),
409 400
         );
410 401
 
@@ -424,11 +415,11 @@  discard block
 block discarded – undo
424 415
         }
425 416
     }
426 417
 
427
-    public function _render_country_list($current='')
418
+    public function _render_country_list($current = '')
428 419
     {
429 420
         $html = '';
430 421
 
431
-        if (   empty($this->_countrylist)
422
+        if (empty($this->_countrylist)
432 423
             || count($this->_countrylist) == 1)
433 424
         {
434 425
             return $html;
@@ -437,7 +428,7 @@  discard block
 block discarded – undo
437 428
         $input_key = $this->_get_input_key("country");
438 429
         $html .= "<label for='{$this->_element_id}_input_place_country' id='{$this->_element_id}_input_place_country_label'>";
439 430
         $html .= "<span class=\"field_text\">" . midcom::get()->i18n->get_string('xep_country', 'org.routamc.positioning') . "</span>";
440
-        $html .= "<select class=\"dropdown position_widget_input position_widget_input_place_country\" id=\"{$this->_element_id}_input_place_country\" name=\"".$input_key."\">";
431
+        $html .= "<select class=\"dropdown position_widget_input position_widget_input_place_country\" id=\"{$this->_element_id}_input_place_country\" name=\"" . $input_key . "\">";
441 432
 
442 433
         foreach ($this->_countrylist as $code => $name)
443 434
         {
@@ -460,19 +451,19 @@  discard block
 block discarded – undo
460 451
         $this->js_options['maxRows'] = 20;
461 452
         $this->js_options['radius'] = 5;
462 453
 
463
-        if (   !is_null($this->js_maxRows)
454
+        if (!is_null($this->js_maxRows)
464 455
             && $this->js_maxRows > 0)
465 456
         {
466 457
             $this->js_options['maxRows'] = $this->js_maxRows;
467 458
         }
468
-        if (   !is_null($this->js_radius)
459
+        if (!is_null($this->js_radius)
469 460
             && $this->js_radius > 0)
470 461
         {
471 462
             $this->js_options['radius'] = $this->js_radius;
472 463
         }
473 464
 
474 465
         $this->js_options_str = "{ ";
475
-        if (! empty($this->js_options))
466
+        if (!empty($this->js_options))
476 467
         {
477 468
             $opt_cnt = count($this->js_options);
478 469
             $i = 0;
@@ -523,8 +514,7 @@  discard block
 block discarded – undo
523 514
             midcom::get()->head->add_jquery_state_script($script);
524 515
         }
525 516
 
526
-        return Array
527
-        (
517
+        return Array(
528 518
             $this->_get_input_key("country") => $this->_type->location->country,
529 519
             $this->_get_input_key("city") => $city_name,
530 520
             $this->_get_input_key("street") => $this->_type->location->street,
@@ -542,12 +532,12 @@  discard block
 block discarded – undo
542 532
         }
543 533
         $city_id = 0;
544 534
         $city = org_routamc_positioning_city_dba::get_by_name($city_name);
545
-        if (   $city
535
+        if ($city
546 536
             && $city->id)
547 537
         {
548 538
             $city_id = $city->id;
549 539
         }
550
-        else if (! empty($results))
540
+        else if (!empty($results))
551 541
         {
552 542
             $city = new org_routamc_positioning_city_dba();
553 543
             $city->city = $city_name;
@@ -572,7 +562,7 @@  discard block
 block discarded – undo
572 562
             {
573 563
                 $city->longitude = $lon;
574 564
             }
575
-            if (! $city->create())
565
+            if (!$city->create())
576 566
             {
577 567
                 debug_add("Cannot save new city '{$city_name}'");
578 568
             }
@@ -585,7 +575,7 @@  discard block
 block discarded – undo
585 575
 
586 576
     private function _get_input_key($input_name)
587 577
     {
588
-        return $this->_element_id . "_input[".$input_name."]";
578
+        return $this->_element_id . "_input[" . $input_name . "]";
589 579
     }
590 580
 
591 581
     private function _get_input($input_name, $data)
@@ -634,7 +624,7 @@  discard block
 block discarded – undo
634 624
 
635 625
         foreach ($this->_allowed_xep_keys as $xep_key)
636 626
         {
637
-            if (   !in_array($xep_key, $this->use_xep_keys)
627
+            if (!in_array($xep_key, $this->use_xep_keys)
638 628
                 || !midcom::get()->dbfactory->property_exists($this->_type->location, $xep_key))
639 629
             {
640 630
                 continue;
Please login to merge, or discard this patch.
lib/org/routamc/positioning/dm2/type.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function convert_to_storage()
56 56
     {
57
-        if (   !$this->storage
57
+        if (!$this->storage
58 58
             || !$this->storage->object)
59 59
         {
60 60
             return '';
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         return '';
77 77
     }
78 78
 
79
-    public function convert_from_csv ($source)
79
+    public function convert_from_csv($source)
80 80
     {
81 81
         // TODO: Not yet supported
82 82
         return '';
Please login to merge, or discard this patch.
lib/org/routamc/positioning/geocoder/geoplugin.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,14 +51,13 @@
 block discarded – undo
51 51
         $json = substr($json, 10, -1);
52 52
         $geocoded = json_decode($json);
53 53
 
54
-        if (   !$geocoded->geoplugin_latitude
54
+        if (!$geocoded->geoplugin_latitude
55 55
             || !$geocoded->geoplugin_longitude)
56 56
         {
57 57
             throw new RuntimeException("GeoPlugin did not return coordinates for IP");
58 58
         }
59 59
 
60
-        $location = array
61
-        (
60
+        $location = array(
62 61
             'latitude' => (float) $geocoded->geoplugin_latitude,
63 62
             'longitude' => (float) $geocoded->geoplugin_longitude,
64 63
         );
Please login to merge, or discard this patch.
lib/org/routamc/positioning/geocoder/city.php 1 patch
Spacing   +13 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,12 +24,11 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $results = array();
26 26
 
27
-        $parameters = array
28
-        (
27
+        $parameters = array(
29 28
             'maxRows' => 1,
30 29
         );
31 30
 
32
-        if (! empty($options))
31
+        if (!empty($options))
33 32
         {
34 33
             foreach ($options as $key => $value)
35 34
             {
@@ -87,12 +86,10 @@  discard block
 block discarded – undo
87 86
 
88 87
         foreach ($matches as $city_entry)
89 88
         {
90
-            $results[] = array
91
-            (
89
+            $results[] = array(
92 90
                 'latitude' => $city_entry->latitude,
93 91
                 'longitude' => $city_entry->longitude,
94
-                'distance' => array
95
-                (
92
+                'distance' => array(
96 93
                     'meters' => 0,
97 94
                     'bearing' => null,
98 95
                 ),
@@ -113,16 +110,15 @@  discard block
 block discarded – undo
113 110
      * @param array $options
114 111
      * @return Array containing geocoded information
115 112
      */
116
-    function reverse_geocode($coordinates, $options=array())
113
+    function reverse_geocode($coordinates, $options = array())
117 114
     {
118 115
         $results = array();
119 116
 
120
-        $parameters = array
121
-        (
117
+        $parameters = array(
122 118
             'maxRows' => 1,
123 119
         );
124 120
 
125
-        if (! empty($options))
121
+        if (!empty($options))
126 122
         {
127 123
             foreach ($options as $key => $value)
128 124
             {
@@ -133,7 +129,7 @@  discard block
 block discarded – undo
133 129
             }
134 130
         }
135 131
 
136
-        if (   !isset($coordinates['latitude'])
132
+        if (!isset($coordinates['latitude'])
137 133
             && !isset($coordinates['longitude']))
138 134
         {
139 135
             $this->error = 'POSITIONING_MISSING_ATTRIBUTES';
@@ -150,18 +146,16 @@  discard block
 block discarded – undo
150 146
 
151 147
         foreach ($closest as $city)
152 148
         {
153
-            $city_coordinates = array
154
-            (
149
+            $city_coordinates = array(
155 150
                 'latitude'  => $city->latitude,
156 151
                 'longitude' => $city->longitude,
157 152
             );
158 153
 
159 154
             $position = array();
160
-            $position['latitude' ] = $city->latitude;
161
-            $position['longitude' ] = $city->longitude;
162
-            $position['distance'] = array
163
-            (
164
-                'meters' => round( org_routamc_positioning_utils::get_distance($coordinates, $city_coordinates) * 1000 ),
155
+            $position['latitude'] = $city->latitude;
156
+            $position['longitude'] = $city->longitude;
157
+            $position['distance'] = array(
158
+                'meters' => round(org_routamc_positioning_utils::get_distance($coordinates, $city_coordinates) * 1000),
165 159
                 'bearing' => org_routamc_positioning_utils::get_bearing($coordinates, $city_coordinates),
166 160
             );
167 161
             $position['city'] = $city->city;
Please login to merge, or discard this patch.
lib/org/routamc/positioning/geocoder/geonames.php 1 patch
Spacing   +28 added lines, -33 removed lines patch added patch discarded remove patch
@@ -23,14 +23,13 @@  discard block
 block discarded – undo
23 23
     {
24 24
         $results = array();
25 25
 
26
-        $parameters = array
27
-        (
26
+        $parameters = array(
28 27
             'radius' => null,
29 28
             'maxRows' => 1,
30 29
             'style' => 'FULL',
31 30
         );
32 31
 
33
-        if (! empty($options))
32
+        if (!empty($options))
34 33
         {
35 34
             foreach ($options as $key => $value)
36 35
             {
@@ -41,7 +40,7 @@  discard block
 block discarded – undo
41 40
             }
42 41
         }
43 42
 
44
-        if (   !isset($location['postalcode'])
43
+        if (!isset($location['postalcode'])
45 44
             && !isset($location['city']))
46 45
         {
47 46
             $this->error = 'POSITIONING_MISSING_ATTRIBUTES';
@@ -64,7 +63,7 @@  discard block
 block discarded – undo
64 63
 
65 64
         foreach ($parameters as $key => $value)
66 65
         {
67
-            if (! is_null($value))
66
+            if (!is_null($value))
68 67
             {
69 68
                 $params[] = "{$key}=" . urlencode($value);
70 69
             }
@@ -86,26 +85,25 @@  discard block
 block discarded – undo
86 85
             return null;
87 86
         }
88 87
 
89
-        for ($i=0; $i<$parameters['maxRows']; $i++)
88
+        for ($i = 0; $i < $parameters['maxRows']; $i++)
90 89
         {
91
-            if (! isset($simplexml->code[$i]))
90
+            if (!isset($simplexml->code[$i]))
92 91
             {
93 92
                 break;
94 93
             }
95 94
             $entry = $simplexml->code[$i];
96 95
 
97 96
             $position = array();
98
-            $position['latitude' ] = (float) $entry->lat;
99
-            $position['longitude' ] = (float) $entry->lng;
100
-            $position['distance'] = array
101
-            (
102
-                'meters' => round( (float) $entry->distance * 1000 ),
97
+            $position['latitude'] = (float) $entry->lat;
98
+            $position['longitude'] = (float) $entry->lng;
99
+            $position['distance'] = array(
100
+                'meters' => round((float) $entry->distance * 1000),
103 101
                 'bearing' => null,
104 102
             );
105
-            $position['city' ] = (string) $entry->name;
106
-            $position['region' ] = (string) $entry->adminName2;
107
-            $position['country' ] = (string) $entry->countryCode;
108
-            $position['postalcode' ] = (string) $entry->postalcode;
103
+            $position['city'] = (string) $entry->name;
104
+            $position['region'] = (string) $entry->adminName2;
105
+            $position['country'] = (string) $entry->countryCode;
106
+            $position['postalcode'] = (string) $entry->postalcode;
109 107
             $position['alternate_names'] = (string) $entry->alternateNames;
110 108
             $position['accuracy'] = org_routamc_positioning_log_dba::ACCURACY_CITY;
111 109
 
@@ -120,18 +118,17 @@  discard block
 block discarded – undo
120 118
      * @param array $coordinates Contains latitude and longitude values
121 119
      * @return Array containing geocoded information
122 120
      */
123
-    function reverse_geocode($coordinates, $options=array())
121
+    function reverse_geocode($coordinates, $options = array())
124 122
     {
125 123
         $results = array();
126 124
 
127
-        $parameters = array
128
-        (
125
+        $parameters = array(
129 126
             'radius' => 10,
130 127
             'maxRows' => 20,
131 128
             'style' => 'FULL',
132 129
         );
133 130
 
134
-        if (! empty($options))
131
+        if (!empty($options))
135 132
         {
136 133
             foreach ($options as $key => $value)
137 134
             {
@@ -142,7 +139,7 @@  discard block
 block discarded – undo
142 139
             }
143 140
         }
144 141
 
145
-        if (   !isset($coordinates['latitude'])
142
+        if (!isset($coordinates['latitude'])
146 143
             && !isset($coordinates['longitude']))
147 144
         {
148 145
             $this->error = 'POSITIONING_MISSING_ATTRIBUTES';
@@ -155,7 +152,7 @@  discard block
 block discarded – undo
155 152
 
156 153
         foreach ($parameters as $key => $value)
157 154
         {
158
-            if (! is_null($value))
155
+            if (!is_null($value))
159 156
             {
160 157
                 $params[] = "{$key}=" . urlencode($value);
161 158
             }
@@ -178,23 +175,22 @@  discard block
 block discarded – undo
178 175
             return null;
179 176
         }
180 177
 
181
-        for ($i=0; $i<$parameters['maxRows']; $i++)
178
+        for ($i = 0; $i < $parameters['maxRows']; $i++)
182 179
         {
183
-            if (! isset($simplexml->geoname[$i]))
180
+            if (!isset($simplexml->geoname[$i]))
184 181
             {
185 182
                 break;
186 183
             }
187 184
 
188 185
             $entry = $simplexml->geoname[$i];
189 186
 
190
-            $entry_coordinates = array
191
-            (
187
+            $entry_coordinates = array(
192 188
                 'latitude'  => (float) $entry->lat,
193 189
                 'longitude' => (float) $entry->lng,
194 190
             );
195 191
 
196
-            $meters = round( org_routamc_positioning_utils::get_distance($coordinates, $entry_coordinates) * 1000 );
197
-            $entry_meters = round( (float) $entry->distance * 1000 );
192
+            $meters = round(org_routamc_positioning_utils::get_distance($coordinates, $entry_coordinates) * 1000);
193
+            $entry_meters = round((float) $entry->distance * 1000);
198 194
 
199 195
             if ($entry_meters < $meters)
200 196
             {
@@ -202,17 +198,16 @@  discard block
 block discarded – undo
202 198
             }
203 199
 
204 200
             $position = array();
205
-            $position['latitude' ] = (float) $entry->lat;
206
-            $position['longitude' ] = (float) $entry->lng;
207
-            $position['distance'] = array
208
-            (
201
+            $position['latitude'] = (float) $entry->lat;
202
+            $position['longitude'] = (float) $entry->lng;
203
+            $position['distance'] = array(
209 204
                 'meters' => $meters,
210 205
                 'bearing' => org_routamc_positioning_utils::get_bearing($coordinates, $entry_coordinates),
211 206
             );
212 207
             $position['city'] = (string) $entry->name;
213 208
             $position['region'] = (string) $entry->adminName2;
214 209
             $position['country'] = (string) $entry->countryCode;
215
-            $position['postalcode' ] = (string) $entry->postalcode;
210
+            $position['postalcode'] = (string) $entry->postalcode;
216 211
             $position['alternate_names'] = (string) $entry->alternateNames;
217 212
             $position['accuracy'] = org_routamc_positioning_log_dba::ACCURACY_GPS;
218 213
 
Please login to merge, or discard this patch.
lib/org/routamc/positioning/aerodrome.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
      */
46 46
     public function _on_creating()
47 47
     {
48
-        if (   $this->longitude
48
+        if ($this->longitude
49 49
             && $this->latitude)
50 50
         {
51 51
             $qb = org_routamc_positioning_aerodrome_dba::new_query_builder();
Please login to merge, or discard this patch.
lib/org/routamc/positioning/location.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
      */
80 80
     public function _on_created()
81 81
     {
82
-        if (   !$this->log
82
+        if (!$this->log
83 83
             && $this->relation == self::RELATION_IN)
84 84
         {
85 85
             // This location entry is defined as being made in a location,
Please login to merge, or discard this patch.
lib/org/routamc/positioning/user.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 {
47 47
     static public function set_location(array $location)
48 48
     {
49
-        if (   !isset($location['latitude'])
49
+        if (!isset($location['latitude'])
50 50
             || !isset($location['longitude']))
51 51
         {
52 52
             throw new InvalidArgumentException('No coordinates provided');
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
     static public function set_location_for_person(array $location, midcom_db_person $person)
67 67
     {
68
-        if (   !isset($location['latitude'])
68
+        if (!isset($location['latitude'])
69 69
             || !isset($location['longitude']))
70 70
         {
71 71
             throw new InvalidArgumentException('No coordinates provided');
Please login to merge, or discard this patch.