diff --git a/app/Console/Commands/RefreshCurrentTrips.php b/app/Console/Commands/RefreshCurrentTrips.php index 437e133ad..2fb29a385 100644 --- a/app/Console/Commands/RefreshCurrentTrips.php +++ b/app/Console/Commands/RefreshCurrentTrips.php @@ -4,7 +4,7 @@ use App\DataProviders\DataProviderFactory; use App\DataProviders\DataProviderInterface; -use App\DataProviders\HafasController; +use App\DataProviders\Hafas; use App\DataProviders\HafasStopoverService; use App\Enum\TripSource; use App\Exceptions\HafasException; @@ -20,7 +20,7 @@ class RefreshCurrentTrips extends Command private function getDataProvider(): DataProviderInterface { // Probably only HafasController is needed here, because this Command is very Hafas specific - return (new DataProviderFactory)->create(HafasController::class); + return (new DataProviderFactory)->create(Hafas::class); } public function handle(): int { diff --git a/app/DataProviders/HafasController.php b/app/DataProviders/Hafas.php similarity index 99% rename from app/DataProviders/HafasController.php rename to app/DataProviders/Hafas.php index ac9833756..9e47faec2 100644 --- a/app/DataProviders/HafasController.php +++ b/app/DataProviders/Hafas.php @@ -23,7 +23,7 @@ use JsonException; use PDOException; -class HafasController extends Controller implements DataProviderInterface +class Hafas extends Controller implements DataProviderInterface { private function client(): PendingRequest { diff --git a/app/Http/Controllers/API/v1/Controller.php b/app/Http/Controllers/API/v1/Controller.php index 87dfcaaa7..f16649298 100644 --- a/app/Http/Controllers/API/v1/Controller.php +++ b/app/Http/Controllers/API/v1/Controller.php @@ -4,7 +4,7 @@ use App\DataProviders\DataProviderFactory; use App\DataProviders\DataProviderInterface; -use App\DataProviders\HafasController; +use App\DataProviders\Hafas; use App\Models\OAuthClient; use App\Models\User; use Illuminate\Contracts\Auth\Authenticatable; @@ -103,7 +103,7 @@ class Controller extends \App\Http\Controllers\Controller public function __construct() { // todo: set data provider based on user settings - $this->dataProvider = (new DataProviderFactory())->create(HafasController::class); + $this->dataProvider = (new DataProviderFactory())->create(Hafas::class); } public function sendResponse( diff --git a/app/Http/Controllers/API/v1/TransportController.php b/app/Http/Controllers/API/v1/TransportController.php index bd44e4158..a6b8a9f6b 100644 --- a/app/Http/Controllers/API/v1/TransportController.php +++ b/app/Http/Controllers/API/v1/TransportController.php @@ -2,7 +2,7 @@ namespace App\Http\Controllers\API\v1; -use App\DataProviders\HafasController; +use App\DataProviders\Hafas; use App\Dto\Transport\Station as StationDto; use App\Enum\Business; use App\Enum\StatusVisibility; @@ -513,7 +513,7 @@ public function setHome(int $stationId): JsonResponse { */ public function getTrainStationAutocomplete(string $query): JsonResponse { try { - $trainAutocompleteResponse = (new TransportBackend(HafasController::class))->getTrainStationAutocomplete($query); + $trainAutocompleteResponse = (new TransportBackend(Hafas::class))->getTrainStationAutocomplete($query); return $this->sendResponse($trainAutocompleteResponse); } catch (HafasException) { return $this->sendError("There has been an error with our data provider", 503); diff --git a/app/Http/Controllers/Frontend/Admin/CheckinController.php b/app/Http/Controllers/Frontend/Admin/CheckinController.php index ace48b5d9..6664280d4 100644 --- a/app/Http/Controllers/Frontend/Admin/CheckinController.php +++ b/app/Http/Controllers/Frontend/Admin/CheckinController.php @@ -3,7 +3,7 @@ namespace App\Http\Controllers\Frontend\Admin; use App\DataProviders\DataProviderFactory; -use App\DataProviders\HafasController; +use App\DataProviders\Hafas; use App\Enum\Business; use App\Enum\StatusVisibility; use App\Enum\TravelType; @@ -36,7 +36,7 @@ class CheckinController * @deprecated adapt admin panel to api endpoints */ public static function lookupStation(string|int $query): Station { - $dataProvider = (new DataProviderFactory)->create(HafasController::class); + $dataProvider = (new DataProviderFactory)->create(Hafas::class); //Lookup by station ibnr if (is_numeric($query)) { @@ -93,7 +93,7 @@ public static function getDeprecatedDepartures( 'next' => $when->clone()->addMinutes(15) ]; - $departures = (new DataProviderFactory)->create(HafasController::class)->getDepartures( + $departures = (new DataProviderFactory)->create(Hafas::class)->getDepartures( station: $station, when: $when, type: $travelType, diff --git a/app/Http/Controllers/Frontend/Admin/EventController.php b/app/Http/Controllers/Frontend/Admin/EventController.php index fd74a9fb9..b19c8eeb7 100644 --- a/app/Http/Controllers/Frontend/Admin/EventController.php +++ b/app/Http/Controllers/Frontend/Admin/EventController.php @@ -4,7 +4,7 @@ use App\DataProviders\DataProviderFactory; use App\DataProviders\DataProviderInterface; -use App\DataProviders\HafasController; +use App\DataProviders\Hafas; use App\Enum\EventRejectionReason; use App\Exceptions\HafasException; use App\Http\Controllers\Backend\Admin\EventController as AdminEventBackend; @@ -25,7 +25,7 @@ class EventController extends Controller private DataProviderInterface $dataProvider; public function __construct(string $dataProvider = null) { - $dataProvider ??= HafasController::class; + $dataProvider ??= Hafas::class; $this->dataProvider = (new DataProviderFactory())->create($dataProvider); } diff --git a/app/Http/Controllers/FrontendTransportController.php b/app/Http/Controllers/FrontendTransportController.php index 2afef4779..0b6b06b6f 100644 --- a/app/Http/Controllers/FrontendTransportController.php +++ b/app/Http/Controllers/FrontendTransportController.php @@ -2,7 +2,7 @@ namespace App\Http\Controllers; -use App\DataProviders\HafasController; +use App\DataProviders\Hafas; use App\Exceptions\HafasException; use App\Http\Controllers\TransportController as TransportBackend; use Illuminate\Http\JsonResponse; @@ -15,7 +15,7 @@ class FrontendTransportController extends Controller public function TrainAutocomplete(string $station): JsonResponse { try { //todo: adapt data provider to users preferences - $provider = new TransportBackend(HafasController::class); + $provider = new TransportBackend(Hafas::class); $trainAutocompleteResponse = $provider->getTrainStationAutocomplete($station); return response()->json($trainAutocompleteResponse); } catch (HafasException $e) { diff --git a/app/Jobs/RefreshStopover.php b/app/Jobs/RefreshStopover.php index 407bb3f0f..9d43328bb 100644 --- a/app/Jobs/RefreshStopover.php +++ b/app/Jobs/RefreshStopover.php @@ -2,7 +2,7 @@ namespace App\Jobs; -use App\DataProviders\HafasController; +use App\DataProviders\Hafas; use App\DataProviders\HafasStopoverService; use App\Exceptions\HafasException; use App\Models\Stopover; @@ -27,6 +27,6 @@ public function __construct(Stopover $stopover) { * @throws HafasException */ public function handle(): void { - (new HafasStopoverService(HafasController::class))->refreshStopover($this->stopover); + (new HafasStopoverService(Hafas::class))->refreshStopover($this->stopover); } } diff --git a/app/Repositories/CheckinHydratorRepository.php b/app/Repositories/CheckinHydratorRepository.php index 1bd1a7868..d7d8d881e 100644 --- a/app/Repositories/CheckinHydratorRepository.php +++ b/app/Repositories/CheckinHydratorRepository.php @@ -3,7 +3,7 @@ namespace App\Repositories; use App\DataProviders\DataProviderFactory; -use App\DataProviders\HafasController; +use App\DataProviders\Hafas; use App\Exceptions\HafasException; use App\Models\Event; use App\Models\Station; @@ -27,7 +27,7 @@ public function getOneStation(string $searchKey, string|int $id): ?Station { */ public function getHafasTrip(string $tripID, string $lineName): Trip { // todo: create trip IDs with a prefix, to distinguish between different data providers - $dataProvider = (new DataProviderFactory)->create(HafasController::class); + $dataProvider = (new DataProviderFactory)->create(Hafas::class); if (is_numeric($tripID)) { $trip = Trip::where('id', $tripID)->where('linename', $lineName)->first(); diff --git a/tests/Feature/StationSearchTest.php b/tests/Feature/StationSearchTest.php index 2db2ad9fa..339c2bbb8 100644 --- a/tests/Feature/StationSearchTest.php +++ b/tests/Feature/StationSearchTest.php @@ -4,7 +4,7 @@ use App\DataProviders\DataProviderFactory; use App\DataProviders\DataProviderInterface; -use App\DataProviders\HafasController; +use App\DataProviders\Hafas; use App\Exceptions\HafasException; use App\Http\Controllers\Frontend\Admin\CheckinController; use App\Models\Station; @@ -19,7 +19,7 @@ class StationSearchTest extends FeatureTestCase public function setUp(): void { parent::setUp(); - $this->dataProvider = (new DataProviderFactory())->create(HafasController::class); + $this->dataProvider = (new DataProviderFactory())->create(Hafas::class); } diff --git a/tests/Feature/Transport/BackendCheckinTest.php b/tests/Feature/Transport/BackendCheckinTest.php index 3527caa46..76d193e00 100644 --- a/tests/Feature/Transport/BackendCheckinTest.php +++ b/tests/Feature/Transport/BackendCheckinTest.php @@ -4,7 +4,7 @@ use App\DataProviders\DataProviderFactory; use App\DataProviders\DataProviderInterface; -use App\DataProviders\HafasController; +use App\DataProviders\Hafas; use App\Enum\TravelType; use App\Exceptions\CheckInCollisionException; use App\Exceptions\HafasException; @@ -27,7 +27,7 @@ class BackendCheckinTest extends FeatureTestCase public function setUp(): void { parent::setUp(); - $this->dataProvider = (new DataProviderFactory())->create(HafasController::class); + $this->dataProvider = (new DataProviderFactory())->create(Hafas::class); } use RefreshDatabase;