Ajout du service pour récupérer les jours fériés #1

Merged
tristan merged 3 commits from feat/service-holidays-day into develop 2026-02-06 09:58:06 +00:00
Showing only changes of commit e4d68812e8 - Show all commits

View File

@@ -15,6 +15,8 @@ use Throwable;
final class PublicHolidayService implements PublicHolidayServiceInterface
{
private const string BASE_URL = 'https://calendrier.api.gouv.fr/jours-feries/';
public function __construct(
private readonly HttpClientInterface $client,
) {}
@@ -29,7 +31,7 @@ final class PublicHolidayService implements PublicHolidayServiceInterface
public function getHolidaysDay(string $zone): array
{
tristan marked this conversation as resolved
Review

Fait une constante pour la base de l'url => private const string BASE_URL= 'mon url';

Fait une constante pour la base de l'url => private const string BASE_URL= 'mon url';
$zone = strtolower(trim($zone));
$url = "https://calendrier.api.gouv.fr/jours-feries/{$zone}.json";
$url = self::BASE_URL."{$zone}.json";
try {
$response = $this->client->request(
@@ -59,7 +61,7 @@ final class PublicHolidayService implements PublicHolidayServiceInterface
{
$zone = strtolower(trim($zone));
$years = trim($years);
$url = "https://calendrier.api.gouv.fr/jours-feries/{$zone}/{$years}.json";
$url = self::BASE_URL."{$zone}/{$years}.json";
try {
$response = $this->client->request('GET', $url);