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

Don't use static methods #69

Closed
Brammm opened this issue Dec 2, 2013 · 6 comments
Closed

Don't use static methods #69

Brammm opened this issue Dec 2, 2013 · 6 comments
Labels
V2 V2 Client

Comments

@Brammm
Copy link

Brammm commented Dec 2, 2013

I know this is a stretch and would require some huge changes, but I'd like to address it none the less: Why does the client depend on static methods?

This highly limits the extensibility of the client. Want to write a Symfony2 bundle for it? Nope. Want to create a wrapper that sets the subdomain and apikey for you? Nope.

If major changes are ever considered, I'd highly suggest using an approach like

$client = new RecurlyClient($subdomain, $apiKey);
$subscription = $client->subscription->get('abcdef01234567890abcdef01234567890');
@drewish
Copy link

drewish commented Dec 2, 2013

If I was feeling snarky I'd say it was because it was started by ruby programmers ;)

I'm happy to look at ways we could make it less static dependent but for this major version we need to keep the API backwards compatible.

@Brammm
Copy link
Author

Brammm commented Dec 3, 2013

Yeah, totally understand. I actually forked the lib and started looking at it, seeing how it could be done, but it's not gonna be that easy, as almost everything is static.

@aheckmann
Copy link

I say go for it, it's the right approach. let's strive for backward compat but if not doable we'll rev the major version.

@Joord
Copy link

Joord commented Feb 13, 2014

Definitely. Also extremely handy for mocking in unit tests.

@dbergunder
Copy link

1 year ago this question was posted - are there any plans on moving forward with refactoring? As it stands the library isn't that versatile.

@drewish
Copy link

drewish commented Dec 3, 2014

@dbergunder There will not be on the 2.x version of client. There's a lot of places that this code shows it age (lack of namespaces being the biggest). We've got some bigger changes to the API planned that will be require updated clients but there's no ETA on that.

So one think thing I will mention is that most of the static methods let you pass in a $client parameter... Definitely not idea ideal but if you're looking to write wrapper code for it that'd give you a way to do it.

@drewish drewish closed this as completed Dec 3, 2014
@bhelx bhelx added the V2 V2 Client label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2 V2 Client
Projects
None yet
Development

No branches or pull requests

6 participants