Skip to content

Commit

Permalink
fix warning in case a file is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach committed Jan 25, 2024
1 parent 4d30204 commit 59e6ae1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Concerns/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ protected function translate(string $country, string $name, ?string $locale = nu
}

$countryName = strtolower($country);
$filePath = __DIR__."/../../lang/{$countryName}/{$locale}/holidays.json";

$content = file_get_contents(__DIR__."/../../lang/{$countryName}/{$locale}/holidays.json");
if (file_exists($filePath)) {
$content = file_get_contents($filePath);
} else {
throw InvalidLocale::notFound($country, $locale);
}

if ($content === false) {
throw InvalidLocale::notFound($country, $locale);
Expand Down

0 comments on commit 59e6ae1

Please sign in to comment.