/** * Set the region to make requests to. * * The data through the API is limited to the region that it is in. For example, * if you set the region as 'us', then you will only receive data when making * requests for the US battlegroups and realms. * * For a complete listing of available regions go to: * https://dev.battle.net/docs/read/community_apis * @param string $region */ public static function setRegion($region) { try { if (!is_string($region)) { $regionVarType = gettype($region); throw new BattleNetAPI_Exception('The method setRegion() expects the parameter $region to be a string, ' . $regionVarType . ' given.'); } if (!in_array($region, self::$_regions)) { throw new BattleNetAPI_Exception('Invalid region. Must be one of the following: "' . implode('", "', self::$_regions) . '"'); } switch ($region) { case 'US': self::$host = 'https://us.api.battle.net'; break; case 'Europe': self::$host = 'https://eu.api.battle.net'; break; case 'Korea': self::$host = 'https://kr.api.battle.net'; break; case 'Taiwan': self::$host = 'https://tw.api.battle.net'; break; case 'China': self::$host = 'https://api.battlenet.com.cn'; break; case 'South East Asia': self::$host = 'https://sea.api.battle.net'; break; } self::$region = $region; } catch (BattleNetAPI_Exception $exception) { $exception->showMessage(); } }