Файл: sngine-v2.8/Script/includes/libs/Stripe/lib/ApiOperations/All.php
Строк: 31
<?php
namespace StripeApiOperations;
/**
* Trait for listable resources. Adds a `all()` static method to the class.
*
* This trait should only be applied to classes that derive from StripeObject.
*/
trait All
{
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws StripeExceptionApiErrorException if the request fails
*
* @return StripeCollection of ApiResources
*/
public static function all($params = null, $opts = null)
{
self::_validateParams($params);
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = StripeUtilUtil::convertToStripeObject($response->json, $opts);
if (!($obj instanceof StripeCollection)) {
throw new StripeExceptionUnexpectedValueException(
'Expected type ' . StripeCollection::class . ', got "' . get_class($obj) . '" instead.'
);
}
$obj->setLastResponse($response);
$obj->setFilters($params);
return $obj;
}
}