leaguewrap icon indicating copy to clipboard operation
leaguewrap copied to clipboard

Object Oriented

Open ctsstc opened this issue 9 years ago • 3 comments

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?

ctsstc avatar Dec 03 '14 02:12 ctsstc

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.

dnlbauer avatar Dec 03 '14 06:12 dnlbauer

thanks that should help :)

it'd still be nice to see some alias wrappers for having something like:

$summoner->stats->ranked();

ctsstc avatar Dec 04 '14 01:12 ctsstc

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?

paquettg avatar Feb 03 '15 18:02 paquettg