From 5680784dbdf518d90478921179130aa0608b6af6 Mon Sep 17 00:00:00 2001 From: Martin Aarhof Date: Wed, 26 Jan 2022 15:06:44 +0100 Subject: [PATCH] Journey details retrival - fixes #12 --- src/AbstractRequest.php | 4 ++-- src/Journey.php | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/AbstractRequest.php b/src/AbstractRequest.php index 8e587ba..3239fbe 100644 --- a/src/AbstractRequest.php +++ b/src/AbstractRequest.php @@ -20,7 +20,7 @@ abstract class AbstractRequest implements Request { - private const BASE_URL = 'https://xmlopen.rejseplanen.dk/bin/rest.exe/'; + protected const BASE_URL = 'https://xmlopen.rejseplanen.dk/bin/rest.exe/'; private const API_NAME = 'rejseplan_php_api'; private const API_VERSION = '3.0'; private const USER_AGENT = self::API_NAME.'/'.self::API_VERSION; @@ -126,7 +126,7 @@ abstract protected function configure(OptionsResolver $resolver): void; abstract protected function getUrl(): string; - private function makeUrl(): string + protected function makeUrl(): string { $query = array_merge(['format' => 'json'], $this->getQuery()); $query = http_build_query($query); diff --git a/src/Journey.php b/src/Journey.php index 35a136e..2d9d968 100644 --- a/src/Journey.php +++ b/src/Journey.php @@ -34,6 +34,11 @@ protected function configure(OptionsResolver $resolver): void $resolver->setRequired(['ref']); } + protected function makeUrl(): string + { + return sprintf('%s%s', self::BASE_URL, $this->options['ref']); + } + protected function getUrl(): string { return 'journeyDetails';