PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.4
GiveWP – Donation Plugin and Fundraising Platform v4.15.4
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / vendor / stripe / stripe-php / lib / SingletonApiResource.php

SingletonApiResource.php in GiveWP – Donation Plugin and Fundraising Platform 4.15.4, at vendor/stripe/stripe-php/lib/SingletonApiResource.php

41 lines 959 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Stripe;
4
5 /**
6 * Class SingletonApiResource.
7 */
8 abstract class SingletonApiResource extends ApiResource
9 {
10 protected static function _singletonRetrieve($options = null)
11 {
12 $opts = Util\RequestOptions::parse($options);
13 $instance = new static(null, $opts);
14 $instance->refresh();
15
16 return $instance;
17 }
18
19 /**
20 * @return string the endpoint associated with this singleton class
21 */
22 public static function classUrl()
23 {
24 // Replace dots with slashes for namespaced resources, e.g. if the object's name is
25 // "foo.bar", then its URL will be "/v1/foo/bar".
26
27 /** @phpstan-ignore-next-line */
28 $base = \str_replace('.', '/', static::OBJECT_NAME);
29
30 return "/v1/{$base}";
31 }
32
33 /**
34 * @return string the endpoint associated with this singleton API resource
35 */
36 public function instanceUrl()
37 {
38 return static::classUrl();
39 }
40 }
41