Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach authored and github-actions[bot] committed Jun 24, 2024
1 parent 26644a6 commit adb572e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/Countries/Australia.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class Australia extends Country
{
protected function __construct(
protected ?string $region = null,
) {
}
) {}

public function countryCode(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Countries/France.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class France extends Country
{
protected function __construct(
protected ?string $region = null,
) {
}
) {}

public function countryCode(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Countries/Germany.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class Germany extends Country implements HasTranslations

protected function __construct(
protected ?string $region = null,
) {
}
) {}

public function countryCode(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Countries/Spain.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class Spain extends Country
{
protected function __construct(
protected ?string $region = null,
) {
}
) {}

public function countryCode(): string
{
Expand Down
10 changes: 5 additions & 5 deletions src/Holidays.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ protected function __construct(
protected ?string $locale = null,
protected ?CarbonImmutable $from = null,
protected ?CarbonImmutable $to = null,
) {
}
) {}

public static function for(Country|string $country, ?int $year = null, ?string $locale = null): static
{
Expand Down Expand Up @@ -57,21 +56,22 @@ public function get(Country|string|null $country = null, ?int $year = null): arr
* E.g. to retrieve all holidays in between
* - 2020-01-01 and 2024-12-31, you could use: getInRange('2020-01-01', '2024-12-31'), getInRange('2020-01', '2024-12') or getInRange('2020', '2024')
* - 2024-06-01 and 2025-05-30, you could use: getInRange('2024-06-01', '2025-05-30'), getInRange('2024-06', '2025-05')
*
* @return array<string, string> date => name
*/
public function getInRange(CarbonInterface|string $from, CarbonInterface|string $to): array
{
if (! $from instanceof CarbonImmutable) {
$from = match (strlen($from)) {
4 => CarbonImmutable::parse($from . '-01-01'),
7 => CarbonImmutable::parse($from . '-01'),
4 => CarbonImmutable::parse($from.'-01-01'),
7 => CarbonImmutable::parse($from.'-01'),
default => CarbonImmutable::parse($from),
};
}

if (! $to instanceof CarbonImmutable) {
$to = match (strlen($to)) {
4 => CarbonImmutable::parse($to . '-12-31'),
4 => CarbonImmutable::parse($to.'-12-31'),
7 => CarbonImmutable::parse($to)->endOfMonth(),
default => CarbonImmutable::parse($to),
};
Expand Down
1 change: 0 additions & 1 deletion tests/HolidaysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
expect($result)->toBeNull();
});


it('can get all holidays between two dates', function (string|CarbonImmutable $from, string|CarbonImmutable $to, int $expectedCount, string $firstName, string $lastName) {
$holidays = Holidays::for('be')->getInRange($from, $to);

Expand Down

0 comments on commit adb572e

Please sign in to comment.