-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Preparations for multiple data sources (#3034)
- Loading branch information
Showing
24 changed files
with
546 additions
and
488 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\DataProviders; | ||
|
||
class DataProviderBuilder | ||
{ | ||
public function build(): DataProviderInterface { | ||
return new Hafas(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace App\DataProviders; | ||
|
||
use App\Enum\TravelType; | ||
use App\Models\Station; | ||
use Carbon\Carbon; | ||
|
||
interface DataProviderInterface | ||
{ | ||
public function fetchHafasTrip(string $tripID, string $lineName); | ||
|
||
public function fetchRawHafasTrip(string $tripId, string $lineName); | ||
|
||
public function getStations(string $query, int $results); | ||
|
||
public function getDepartures(Station $station, Carbon $when, int $duration = 15, TravelType $type = null, bool $localtime = false); | ||
|
||
public function getNearbyStations(float $latitude, float $longitude, int $results); | ||
|
||
public function getStationByRilIdentifier(string $rilIdentifier); | ||
|
||
public function getStationsByFuzzyRilIdentifier(string $rilIdentifier); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace App\DataProviders; | ||
|
||
use App\Enum\TravelType; | ||
|
||
class FptfHelper | ||
{ | ||
public static function checkTravelType(?TravelType $type, TravelType $travelType): string { | ||
return (is_null($type) || $type === $travelType) ? 'true' : 'false'; | ||
} | ||
} |
Oops, something went wrong.