Skip to content

Commit

Permalink
refactor function placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
pisyek committed Mar 2, 2024
1 parent c8c331a commit c929e4b
Showing 1 changed file with 24 additions and 39 deletions.
63 changes: 24 additions & 39 deletions src/Countries/Malaysia.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function variableHolidays(int $year): array
'Tahun Baru Cina Hari Kedua' => $this->chineseToGregorianDate('01-02', $year),
'Hari Raya Aidilfitri' => $this->islamicToGregorianDate('10-01', $year),
'Hari Raya Aidilfitri Hari Kedua' => $this->islamicToGregorianDate('10-02', $year),
'Hari Wesak' => $this->hariWesak($year),
'Hari Wesak' => '01-01',
'Hari Raya Aidiladha' => $this->islamicToGregorianDate('12-10', $year),
'Awal Muharram' => $this->islamicToGregorianDate('01-01', $year, true),
'Maulidur Rasul' => $this->islamicToGregorianDate('03-12', $year, true),
Expand Down Expand Up @@ -149,9 +149,9 @@ protected function regionJohor(int $year): array
{
$johorHolidays = [
'Hari Keputeraan Sultan Johor' => '03-23',
'Hari Thaipusam' => $this->hariThaipusam($year),
'Hari Thaipusam' => '01-01',
'Awal Ramadan' => $this->islamicToGregorianDate('09-01', $year),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];

$hariHolJohor = match ($year) {
Expand All @@ -178,12 +178,12 @@ protected function regionJohor(int $year): array
protected function regionKedah(int $year): array
{
return [
'Hari Thaipusam' => $this->hariThaipusam($year),
'Hari Thaipusam' => '01-01',
'Israk dan Mikraj' => $this->islamicToGregorianDate('07-27', $year),
'Awal Ramadan' => $this->islamicToGregorianDate('09-01', $year),
'Hari Keputeraan Sultan Kedah' => CarbonImmutable::parse("third sunday of june {$year}"),
'Hari Raya Aidiladha Hari Kedua' => $this->islamicToGregorianDate('12-11', $year),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];
}

Expand All @@ -196,7 +196,7 @@ protected function regionKelantan(int $year): array
'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year),
'Hari Arafah' => $this->islamicToGregorianDate('12-09', $year),
'Hari Raya Aidiladha Hari Kedua' => $this->islamicToGregorianDate('12-11', $year),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];

$kingBirthday = match (true) {
Expand Down Expand Up @@ -230,10 +230,10 @@ protected function regionKualaLumpur(int $year): array
{
return [
'Tahun Baru' => '01-01',
'Hari Thaipusam' => $this->hariThaipusam($year),
'Hari Thaipusam' => '01-01',
'Hari Wilayah Persekutuan' => $this->hariWilayah($year),
'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];
}

Expand All @@ -248,7 +248,7 @@ protected function regionLabuan(int $year): array
'Pesta Kaamatan' => $this->pestaKaamatan($year),
'Pesta Kaamatan Hari Kedua' => $this->pestaKaamatan($year)->addDay(),
'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];
}

Expand All @@ -262,7 +262,7 @@ protected function regionMelaka(int $year): array
'Awal Ramadan' => $this->islamicToGregorianDate('09-01', $year),
'Hari Perisytiharan Melaka Sebagai Bandaraya Bersejarah' => CarbonImmutable::createFromDate($year, 4, 15),
'Harijadi Yang di-Pertua Negeri Melaka' => CarbonImmutable::createFromDate($year, 8, 24),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];
}

Expand All @@ -273,10 +273,10 @@ protected function regionNegeri9(int $year): array
{
return [
'Tahun Baru' => '01-01',
'Hari Thaipusam' => $this->hariThaipusam($year),
'Hari Thaipusam' => '01-01',
'Israk dan Mikraj' => $this->islamicToGregorianDate('07-27', $year),
'Hari Keputeraan Yang Di-Pertuan Besar Negeri Sembilan' => CarbonImmutable::createFromDate($year, 1, 14),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];
}

Expand All @@ -290,7 +290,7 @@ protected function regionPahang(int $year): array
'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year),
'Hari Hol Pahang' => CarbonImmutable::createFromDate($year, 5, 22),
'Hari Keputeraan Sultan Pahang' => CarbonImmutable::createFromDate($year, 7, 30),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];
}

Expand All @@ -301,11 +301,11 @@ protected function regionPenang(int $year): array
{
return [
'Tahun Baru' => '01-01',
'Hari Thaipusam' => $this->hariThaipusam($year),
'Hari Thaipusam' => '01-01',
'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year),
'Hari Bandar Warisan Dunia Georgetown' => CarbonImmutable::createFromDate($year, 7, 7),
'Harijadi Yang di-Pertua Negeri Pulau Pinang' => CarbonImmutable::parse("second saturday of july {$year}"),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];
}

Expand All @@ -316,10 +316,10 @@ protected function regionPerak(int $year): array
{
return [
'Tahun Baru' => '01-01',
'Hari Thaipusam' => $this->hariThaipusam($year),
'Hari Thaipusam' => '01-01',
'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year),
'Hari Keputeraan Sultan Perak' => CarbonImmutable::parse("first friday of november {$year}"),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];
}

Expand All @@ -333,7 +333,7 @@ protected function regionPerlis(int $year): array
'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year),
'Hari Keputeraan Raja Perlis' => CarbonImmutable::createFromDate($year, 5, 17),
'Hari Raya Aidiladha Hari Kedua' => $this->islamicToGregorianDate('12-11', $year),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];
}

Expand All @@ -344,10 +344,10 @@ protected function regionPutrajaya(int $year): array
{
return [
'Tahun Baru' => '01-01',
'Hari Thaipusam' => $this->hariThaipusam($year),
'Hari Thaipusam' => '01-01',
'Hari Wilayah Persekutuan' => $this->hariWilayah($year),
'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];
}

Expand All @@ -362,7 +362,7 @@ protected function regionSabah(int $year): array
'Pesta Kaamatan Hari Kedua' => $this->pestaKaamatan($year)->addDays(1),
'Good Friday' => $this->goodFriday($year),
'Harijadi Yang di-Pertua Negeri Sabah' => CarbonImmutable::parse("first saturday of october {$year}"),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
'Hari Natal' => CarbonImmutable::createFromDate($year, 12, 24),
];
}
Expand All @@ -389,9 +389,9 @@ protected function regionSelangor(int $year): array
{
return [
'Tahun Baru' => '01-01',
'Hari Thaipusam' => $this->hariThaipusam($year),
'Hari Thaipusam' => '01-01',
'Hari Nurul Al-Quran' => $this->islamicToGregorianDate('09-17', $year),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
'Hari Keputeraan Sultan Selangor' => CarbonImmutable::createFromDate($year, 12, 11),
];
}
Expand All @@ -408,7 +408,7 @@ protected function regionTerengganu(int $year): array
'Hari Keputeraan Sultan Terengganu' => CarbonImmutable::createFromDate($year, 4, 26),
'Hari Arafah' => $this->islamicToGregorianDate('12-09', $year),
'Hari Raya Aidiladha Hari Kedua' => $this->islamicToGregorianDate('12-11', $year),
'Hari Deepavali' => $this->hariDeepavali($year),
'Hari Deepavali' => '01-01',
];
}

Expand Down Expand Up @@ -436,19 +436,4 @@ protected function hariKeputeraanYDP(int $year): ?CarbonImmutable
default => null,
};
}

protected function hariWesak(int $year): string
{
return '01-01';
}

protected function hariThaipusam(int $year): string
{
return '01-01';
}

protected function hariDeepavali(int $year): string
{
return '01-01';
}
}

0 comments on commit c929e4b

Please sign in to comment.