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

31 lines
734 B
PHP
Raw Normal View History

2018-03-07 19:26:06 +01:00
<?php
namespace Stripe\ApiOperations;
/**
* Trait for deletable resources. Adds a `delete()` method to the class.
*
* This trait should only be applied to classes that derive from StripeObject.
*/
trait Delete
{
/**
2021-01-03 23:37:44 +01:00
* @param null|array $params
* @param null|array|string $opts
2018-03-07 19:26:06 +01:00
*
2021-01-03 23:37:44 +01:00
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static the deleted resource
2018-03-07 19:26:06 +01:00
*/
public function delete($params = null, $opts = null)
{
self::_validateParams($params);
$url = $this->instanceUrl();
list($response, $opts) = $this->_request('delete', $url, $params, $opts);
$this->refreshFrom($response, $opts);
2021-01-03 23:37:44 +01:00
2018-03-07 19:26:06 +01:00
return $this;
}
}