paquettg / leaguewrap

League of Legend API wrapper
MIT License
67 stars 28 forks source link

Curentgame #62

Closed JohnyGemityg closed 9 years ago

JohnyGemityg commented 9 years ago

Hello, first of all thank you for your excelent job.

My question is.

If I get current game I need to do:

$this->api->currentGame()->currentGame($this->player)

Is it ok ? Why do I need to call curentGame twice ?

paquettg commented 9 years ago

If $this->api is an instance of the LeagueWrap\Api object than ya, that is correct.

I get why it can be confusing. The first currentGame() call creates a new instance of the current game end point object:

https://github.com/paquettg/leaguewrap/blob/master/src/LeagueWrap/Api/Currentgame.php

Each endpoint has its own class that wraps all calls that can be done to that end point. For larger end points that can be many different calls but, in the case of the current game end point, it's only 1 call which makes it seem kinda stupid but, if they add more calls to the currentGame end point adding a new call to the endpoint is trivial, which is nice.

I hope that explains that. If you have an idea on how to solve this situation I am more than happy to talk about it to help make the api easier to use and still designed soundly.