Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/externals/stripe-php/lib/Stripe/SingletonApiResource.php
12256 views
1
<?php
2
3
abstract class Stripe_SingletonApiResource extends Stripe_ApiResource
4
{
5
protected static function _scopedSingletonRetrieve($class, $apiKey=null)
6
{
7
$instance = new $class(null, $apiKey);
8
$instance->refresh();
9
return $instance;
10
}
11
12
/**
13
* @param Stripe_SingletonApiResource $class
14
* @return string The endpoint associated with this singleton class.
15
*/
16
public static function classUrl($class)
17
{
18
$base = self::className($class);
19
return "/v1/${base}";
20
}
21
22
/**
23
* @return string The endpoint associated with this singleton API resource.
24
*/
25
public function instanceUrl()
26
{
27
$class = get_class($this);
28
$base = self::classUrl($class);
29
return "$base";
30
}
31
}
32
33