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

ApiResponse interface #11

Closed
sagikazarmark opened this issue Dec 10, 2016 · 5 comments
Closed

ApiResponse interface #11

sagikazarmark opened this issue Dec 10, 2016 · 5 comments

Comments

@sagikazarmark
Copy link
Contributor

What's the rationale behind? IMO the ApiClient/Resource knows the Model to use, doesn't it? In that case an extra interface does not really add anything, does it?

@Nyholm
Copy link
Member

Nyholm commented Dec 10, 2016

@sagikazarmark
Copy link
Contributor Author

Ah, missed that. Well, it looks a bit strange from a domain point of view. Wonder if we could get around this with duck typing.

In any case: call it Model?

@Nyholm
Copy link
Member

Nyholm commented Dec 10, 2016

Yes, Rename the namespace Resource\Api to Model\Api.

What do you mean with "duck typing"?

@sagikazarmark
Copy link
Contributor Author

Duck typing: check if there is a create method and it accepts an array instead of checking with an interface. Less elegant, but does not interfere with the domain. But it doesn't really matter after all. Any reason why it should be Model\Api instead of just Model?

@Nyholm
Copy link
Member

Nyholm commented Dec 11, 2016

Using duck typing is not type safe. We do not have the contract that is provided with the interface that makes sure that the create function accepts an array as first argument.

Any reason why it should be Model\Api instead of just Model?

What if we have other models in our client? But hm... what other models should that be?

No, no real reason.

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

No branches or pull requests

2 participants