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

Better classUrl() #498

Merged
merged 1 commit into from
Jul 19, 2018
Merged

Better classUrl() #498

merged 1 commit into from
Jul 19, 2018

Conversation

ob-stripe
Copy link
Contributor

r? @brandur-stripe @remi-stripe
cc @stripe/api-libraries

Simplifies classUrl() by using the recently-added OBJECT_NAME class constants. Removes className() entirely.

Copy link
Contributor

@remi-stripe remi-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So happy to see this change, I left a minor comment but I think it's ready otherwise

* @return string The name of the class, with namespacing and underscores
* stripped.
*/
public static function className()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm so glad to see this one go

@@ -103,7 +79,7 @@ public static function baseUrl()
*/
public static function classUrl()
{
$base = static::className();
$base = str_replace('.', '/', static::OBJECT_NAME);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we likely should add a comment about that one to be clearer/more discoverable in the future

@@ -22,7 +22,7 @@ protected static function _singletonRetrieve($options = null)
*/
public static function classUrl()
{
$base = static::className();
$base = static::OBJECT_NAME;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OOC what is that file about? I don't remember seeing it before

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only singleton resource is Balance. I guess that we expected this to be a more common pattern in the API than it ended up being.

@brandur-stripe
Copy link
Contributor

LGTM. Very nice cleanup!

@ob-stripe ob-stripe force-pushed the ob-better-classurl branch from 8111deb to 1ae9095 Compare July 19, 2018 09:20
@ob-stripe ob-stripe merged commit cc4e808 into master Jul 19, 2018
@ob-stripe ob-stripe deleted the ob-better-classurl branch July 19, 2018 09:44
@ob-stripe
Copy link
Contributor Author

Released as 6.10.4.

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

Successfully merging this pull request may close these issues.

4 participants