dolibarr/htdocs/includes/stripe/stripe-php/lib/ApiOperations/Retrieve.php

31 lines
750 B
PHP
Raw Permalink Normal View History

2018-03-07 18:26:06 +00:00
<?php
namespace Stripe\ApiOperations;
/**
* Trait for retrievable resources. Adds a `retrieve()` static method to the
* class.
*
* This trait should only be applied to classes that derive from StripeObject.
*/
trait Retrieve
{
/**
2021-01-03 22:37:44 +00:00
* @param array|string $id the ID of the API resource to retrieve,
* or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
2018-03-07 18:26:06 +00:00
*
2019-05-03 00:22:27 +00:00
* @return static
2018-03-07 18:26:06 +00:00
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();
2021-01-03 22:37:44 +00:00
2018-03-07 18:26:06 +00:00
return $instance;
}
}