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

Refactor DataDragonAPI calls from LeagueAPI #31

Closed
dolejska-daniel opened this issue Dec 14, 2018 · 0 comments
Closed

Refactor DataDragonAPI calls from LeagueAPI #31

dolejska-daniel opened this issue Dec 14, 2018 · 0 comments
Assignees
Labels
enhancement A good idea for new feature.

Comments

@dolejska-daniel
Copy link
Owner

DataDragonAPI calls template:

$result = false;
try
{
	// Fetch StaticData from JSON files
	$result = DataDragonAPI::FUNCTION_NAME(...$PARAMETERS);
	if (!$result) throw new ServerException("StaticData failed to be loaded.");

	$this->result_data = $result;
}
catch (DataDragonExceptions\SettingsException $ex)
{
	throw new SettingsException("DataDragon API was not initialized properly! StaticData endpoints cannot be used.");
}
catch (DataDragonExceptions\ArgumentException $ex)
{
	throw new RequestException($ex->getMessage(), $ex->getCode());
}
finally
{
	// Parse array and create instances
	return new ApiObject($result, $this);
}

Should be refactored to "kind of" match up with normal API calls:

$this->setEndpoint("/lol/league/" . self::RESOURCE_LEAGUE_VERSION . "/grandmasterleagues/by-queue/{$game_queue_type}")
	->setResource(self::RESOURCE_LEAGUE, "/grandmasterleagues/by-queue/%s")
	->makeCall();

return new Objects\LeagueListDto($this->getResult(), $this);
@dolejska-daniel dolejska-daniel self-assigned this Dec 14, 2018
@dolejska-daniel dolejska-daniel added the enhancement A good idea for new feature. label Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A good idea for new feature.
Projects
None yet
Development

No branches or pull requests

1 participant