2017-04-18 03:44:08 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Stripe;
|
|
|
|
|
|
|
|
|
|
/**
|
2021-01-03 22:37:44 +00:00
|
|
|
* Class SingletonApiResource.
|
2017-04-18 03:44:08 +00:00
|
|
|
*/
|
|
|
|
|
abstract class SingletonApiResource extends ApiResource
|
|
|
|
|
{
|
|
|
|
|
/**
|
2021-01-03 22:37:44 +00:00
|
|
|
* @return string the endpoint associated with this singleton class
|
2017-04-18 03:44:08 +00:00
|
|
|
*/
|
|
|
|
|
public static function classUrl()
|
|
|
|
|
{
|
2019-05-03 00:22:27 +00:00
|
|
|
// Replace dots with slashes for namespaced resources, e.g. if the object's name is
|
|
|
|
|
// "foo.bar", then its URL will be "/v1/foo/bar".
|
2023-04-24 16:42:04 +00:00
|
|
|
|
|
|
|
|
/** @phpstan-ignore-next-line */
|
2021-01-03 22:37:44 +00:00
|
|
|
$base = \str_replace('.', '/', static::OBJECT_NAME);
|
|
|
|
|
|
|
|
|
|
return "/v1/{$base}";
|
2017-04-18 03:44:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-01-03 22:37:44 +00:00
|
|
|
* @return string the endpoint associated with this singleton API resource
|
2017-04-18 03:44:08 +00:00
|
|
|
*/
|
|
|
|
|
public function instanceUrl()
|
|
|
|
|
{
|
|
|
|
|
return static::classUrl();
|
|
|
|
|
}
|
|
|
|
|
}
|