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

Object Oriented #48

Open
ctsstc opened this issue Dec 3, 2014 · 3 comments
Open

Object Oriented #48

ctsstc opened this issue Dec 3, 2014 · 3 comments

Comments

@ctsstc
Copy link

ctsstc commented Dec 3, 2014

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?

@dnlbauer
Copy link
Collaborator

dnlbauer commented Dec 3, 2014

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.

@ctsstc
Copy link
Author

ctsstc commented Dec 4, 2014

thanks that should help :)

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

$summoner->stats->ranked();

@paquettg
Copy link
Owner

paquettg commented Feb 3, 2015

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants