ARCANEDEV /
Stripe
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php namespace Arcanedev\Stripe; |
||
| 2 | |||
| 3 | /** |
||
| 4 | * Class SingletonResource |
||
| 5 | * |
||
| 6 | * @package Arcanedev\Stripe |
||
| 7 | * @author ARCANEDEV <[email protected]> |
||
| 8 | */ |
||
| 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 | 10 | 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 = '') |
|
| 40 | { |
||
| 41 | 10 | $base = self::className($class); |
|
| 42 | |||
| 43 | 10 | return "/v1/${base}"; |
|
| 44 | } |
||
| 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 = '') |
||
| 54 | { |
||
| 55 | 10 | $class = get_class($this); |
|
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 56 | 10 | $base = self::classUrl($class); |
|
| 57 | |||
| 58 | 10 | return (string) $base; |
|
| 59 | } |
||
| 60 | } |
||
| 61 |