| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
-
- namespace App\Commerce\Shipping\EasyParcel;
-
- /**
- * EasyParcel names Malaysian states by their ISO 3166-2 code, such as MY-07 for Pulau Pinang.
- */
- final class StateCodes
- {
- /**
- * Keyed by the names in MalaysianStates::ALL.
- *
- * @var array<string, string>
- */
- public const array CODES = [
- 'Johor' => 'MY-01',
- 'Kedah' => 'MY-02',
- 'Kelantan' => 'MY-03',
- 'Melaka' => 'MY-04',
- 'Negeri Sembilan' => 'MY-05',
- 'Pahang' => 'MY-06',
- 'Pulau Pinang' => 'MY-07',
- 'Perak' => 'MY-08',
- 'Perlis' => 'MY-09',
- 'Selangor' => 'MY-10',
- 'Terengganu' => 'MY-11',
- 'Sabah' => 'MY-12',
- 'Sarawak' => 'MY-13',
- 'Kuala Lumpur' => 'MY-14',
- 'Labuan' => 'MY-15',
- 'Putrajaya' => 'MY-16',
- ];
-
- public static function for(string $state): ?string
- {
- return self::CODES[$state] ?? null;
- }
- }
|