diff --git a/src/irail/stations/Stations.php b/src/irail/stations/Stations.php index 266921f..9ef78f1 100644 --- a/src/irail/stations/Stations.php +++ b/src/irail/stations/Stations.php @@ -34,6 +34,9 @@ public static function getStations($query = '', $country = '') $newstations->{'@context'} = $stations->{'@context'}; $newstations->{'@graph'} = []; + //https://github.com/iRail/stations/issues/72 + $query = str_ireplace('- ', '-', $query); + //https://github.com/iRail/hyperRail/issues/129 $query = str_ireplace('l alleud', "l'alleud", $query); diff --git a/tests/StationsTest.php b/tests/StationsTest.php index 313a020..ff3a15a 100644 --- a/tests/StationsTest.php +++ b/tests/StationsTest.php @@ -88,6 +88,12 @@ public function testEdgeCases() $result5a = Stations::getStations("braine l'alleud"); $result5b = Stations::getStations('braine l alleud'); //for hafas purposes: https://github.com/iRail/hyperRail/issues/129 $this->assertEquals($result5a->{'@graph'}[0]->{'@id'}, $result5b->{'@graph'}[0]->{'@id'}); + + // Check whether a space after a - doesn't break the autocomplete: https://github.com/iRail/stations/issues/72 + $result6a = Stations::getStations('La Louviere- Centre'); + $result6b = Stations::getStations('La Louvière-Centre'); + $this->assertEquals($result6a->{'@graph'}[0]->{'@id'}, $result6b->{'@graph'}[0]->{'@id'}); + } public function testId()