Skip to content

Commit

Permalink
fix empty radius
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Baettig committed Jan 20, 2020
1 parent 7e0901f commit b9cce72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/SwissGeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function findPointByAddress(string $location): ?array
return ['x' => $firstElement['attrs']['x'], 'y' => $firstElement['attrs']['y']];
}

public static function findCitiesNearPoint(float $x, float $y, float $radius): ?array
public static function findCitiesNearPoint(float $x, float $y, float $radius = 0): ?array
{
$locations = GeoAdminGateway::getLocationsByGeometryPoint($x, $y, $radius);
if (count($locations['results']) === 0) {
Expand Down
1 change: 1 addition & 0 deletions tests/SwissGeo/SwissGeoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function testFindPointByAddress()
public function testFindCitiesNearPoint()
{
$this->assertCount(2,SwissGeo::findCitiesNearPoint(210318.1875, 657089.5,1.5));
$this->assertCount(1,SwissGeo::findCitiesNearPoint(210318.1875, 657089.5));
}

public function testFindPostcodeByCity()
Expand Down

0 comments on commit b9cce72

Please sign in to comment.