Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new regions #12

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Base/Definitions/IRegion.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ interface IRegion

const ASIA = 'asia';

const SEA = 'sea';

/**
* Returns region list.
*
Expand Down
20 changes: 20 additions & 0 deletions src/Base/Definitions/Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,22 @@ class Platform implements IPlatform
const OCEANIA = 'oc1';
const KOREA = 'kr';
const JAPAN = 'jp1';
const PHILIPPINES = 'ph2';
const SINGAPORE = 'sg2';
const TAIWAN = 'tw2';
const THAILAND = 'th2';
const VIETNAM = 'vn2';

const AMERICAS = 'americas';
const EUROPE = 'europe';
const ASIA = 'asia';
const SEA = 'sea';

public static $list = array(
IRegion::EUROPE => self::EUROPE,
IRegion::AMERICAS => self::AMERICAS,
IRegion::ASIA => self::ASIA,
IRegion::SEA => self::SEA,
Region::NORTH_AMERICA => self::NORTH_AMERICA,
Region::EUROPE_WEST => self::EUROPE_WEST,
Region::EUROPE_EAST => self::EUROPE_EAST,
Expand All @@ -64,12 +71,18 @@ class Platform implements IPlatform
Region::OCEANIA => self::OCEANIA,
Region::KOREA => self::KOREA,
Region::JAPAN => self::JAPAN,
Region::PHILIPPINES => self::PHILIPPINES,
Region::SINGAPORE => self::SINGAPORE,
Region::TAIWAN => self::TAIWAN,
Region::THAILAND => self::THAILAND,
Region::VIETNAM => self::VIETNAM,
);

public static $continentalRegions = [
self::AMERICAS,
self::EUROPE,
self::ASIA,
self::SEA,
];


Expand Down Expand Up @@ -117,6 +130,13 @@ public function getCorrespondingContinentRegion($region): string
case Platform::JAPAN:
return IRegion::ASIA;

case Platform::PHILIPPINES:
case Platform::SINGAPORE:
case Platform::TAIWAN:
case Platform::THAILAND:
case Platform::VIETNAM:
return IRegion::SEA;

default:
throw new GeneralException("Unable to convert '$region' platform ID to corresponding continent region.");
}
Expand Down
11 changes: 11 additions & 0 deletions src/Base/Definitions/Region.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class Region implements IRegion
const OCEANIA = 'oce';
const KOREA = 'kr';
const JAPAN = 'jp';
const PHILIPPINES = 'ph';
const SINGAPORE = 'sg';
const TAIWAN = 'tw';
const THAILAND = 'th';
const VIETNAM = 'vn';

public static $list = array(
self::NORTH_AMERICA => self::NORTH_AMERICA,
Expand All @@ -60,6 +65,12 @@ class Region implements IRegion
self::KOREA => self::KOREA,
self::JAPAN => self::JAPAN,
self::AMERICAS => self::AMERICAS,
self::SEA => self::SEA,
self::PHILIPPINES => self::PHILIPPINES,
self::SINGAPORE => self::SINGAPORE,
self::TAIWAN => self::TAIWAN,
self::THAILAND => self::THAILAND,
self::VIETNAM => self::VIETNAM,
);


Expand Down
Loading