-
Notifications
You must be signed in to change notification settings - Fork 850
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
Better classUrl()
#498
Conversation
There was a problem hiding this 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() |
There was a problem hiding this comment.
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
lib/ApiResource.php
Outdated
@@ -103,7 +79,7 @@ public static function baseUrl() | |||
*/ | |||
public static function classUrl() | |||
{ | |||
$base = static::className(); | |||
$base = str_replace('.', '/', static::OBJECT_NAME); |
There was a problem hiding this comment.
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
lib/SingletonApiResource.php
Outdated
@@ -22,7 +22,7 @@ protected static function _singletonRetrieve($options = null) | |||
*/ | |||
public static function classUrl() | |||
{ | |||
$base = static::className(); | |||
$base = static::OBJECT_NAME; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
LGTM. Very nice cleanup! |
6cbb9b2
to
8111deb
Compare
8111deb
to
1ae9095
Compare
Released as 6.10.4. |
r? @brandur-stripe @remi-stripe
cc @stripe/api-libraries
Simplifies
classUrl()
by using the recently-addedOBJECT_NAME
class constants. RemovesclassName()
entirely.