Adopt changes in master branch, add typehints

This commit is contained in:
Björn Fromme
2022-02-23 10:51:53 +01:00
parent 43a752e078
commit 5fbe275b74
@@ -38,11 +38,7 @@ class BookingUrlUtility
const COOKIE_NAME_BPN = 'bpn_cookie';
const URL_BASE = 'https://bpn.ep-reisen.de/buspronet/maske_buchung.php';
/**
* @param array $options
* @return string
*/
public static function generateUrl(array $options)
public static function generateUrl(array $options): string
{
$resolver = new OptionsResolver();
$resolver->setDefined('paCode');
@@ -87,11 +83,7 @@ class BookingUrlUtility
return static::buildUrl($query);
}
/**
* @param array $options
* @return string
*/
public static function generateResellerUrl(array $options)
public static function generateResellerUrl(array $options): string
{
$resolver = new OptionsResolver();
$resolver->setDefined('paCode');
@@ -119,15 +111,7 @@ class BookingUrlUtility
return static::buildUrl($query);
}
/**
* @param string $bookingId
* @param string $hotelId
* @param string $dateEnd
* @param string $template
* @param bool $isDayTrip
* @return array
*/
protected static function buildQuery($bookingId, $hotelId, $dateEnd, $template = 'base', $isDayTrip = false)
protected static function buildQuery(string $bookingId, string $hotelId, ?string $dateEnd, string $template = 'base', bool $isDayTrip = false): array
{
$query = [
'id' => $bookingId,
@@ -145,16 +129,18 @@ class BookingUrlUtility
return $query;
}
/**
* @param array $query
* @return string
*/
protected static function buildUrl(array $query): string
{
$baseUrl = GeneralUtility::makeInstance(SiteFinder::class)
->getSiteByIdentifier('ep-reisen')
->getBase();
/** @var SiteFinder $siteFinder */
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
return $baseUrl . '/buchung/maske_buchung.php?' . http_build_query($query, '', '&');
}
$pageId = $GLOBALS['TSFE']->id;
if (null !== $pageId) {
$site = $siteFinder->getSiteByPageId($pageId);
} else {
$site = $siteFinder->getSiteByIdentifier('ep-reisen');
}
return $site->getBase() . '/buchung/maske_buchung.php?' . http_build_query($query); }
}