| 1 | <?php namespace Arcanedev\Stripe; |
||
| 9 | class SingletonResource extends StripeResource |
||
| 10 | { |
||
| 11 | /* ------------------------------------------------------------------------------------------------ |
||
| 12 | | Main Functions |
||
| 13 | | ------------------------------------------------------------------------------------------------ |
||
| 14 | */ |
||
| 15 | /** |
||
| 16 | * Retrieve a singleton resource |
||
| 17 | * |
||
| 18 | * @param string $class |
||
| 19 | * @param array|string|null $apiKey |
||
| 20 | * |
||
| 21 | * @return SingletonResource |
||
| 22 | */ |
||
| 23 | 10 | protected static function scopedSingletonRetrieve($class, $apiKey = null) |
|
| 24 | { |
||
| 25 | /** @var self $instance */ |
||
| 26 | 10 | $instance = new $class(null, $apiKey); |
|
| 27 | 10 | $instance->refresh(); |
|
| 28 | |||
| 29 | return $instance; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Get resource URL. |
||
| 34 | * |
||
| 35 | * @param string $class |
||
| 36 | * |
||
| 37 | * @return string - The endpoint associated with this singleton class. |
||
| 38 | */ |
||
| 39 | 10 | public static function classUrl($class = '') |
|
| 45 | |||
| 46 | /** |
||
| 47 | * The endpoint associated with this singleton API resource. |
||
| 48 | * |
||
| 49 | * @param string $class |
||
| 50 | * |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | public function instanceUrl($class = '') |
||
| 60 | } |
||
| 61 |