leaguewrap
leaguewrap copied to clipboard
Object Oriented
Why are there so many calls that require id's for instance a summoner id:
$api->stats()->ranked($summoner->id);
Rather than be like:
$summoner->stats->ranked();
I imagine this saves api calls? But if you have a populated summoner instance then you'll have the summoner Id available to that instance. I imagine that we would also then need to have static methods / the current method so that when you already had id's on hand via DB or etc that you could still call them. Maybe there could be a way to populate instances too with an array pulled from the DB/ORM?
You can also do
$api->stats()->ranked($summoner);
or
$api->stats()->ranked( [$summoner1, $summoner2, $summoner3] );
There is no need to extract the Id on your own.
thanks that should help :)
it'd still be nice to see some alias wrappers for having something like:
$summoner->stats->ranked();
I agree with you but the problem in implementing this feature is two folds.
First, the summoner DTO that you are using does not know about the API, it's only a data transfer object and, as such, only contains information that we got from the api.
Second, this would add a lot of extra methods, or attributes, to the summoner dto which do not really belong.
How would you propose solving both of these design issues?