| 1 |
<?php |
| 2 |
|
| 3 |
namespace Stripe\ApiOperations; |
| 4 |
|
| 5 |
/** |
| 6 |
* Trait for deletable resources. Adds a `delete()` method to the class. |
| 7 |
* |
| 8 |
* This trait should only be applied to classes that derive from StripeObject. |
| 9 |
*/ |
| 10 |
trait Delete |
| 11 |
{ |
| 12 |
/** |
| 13 |
* @param null|array $params |
| 14 |
* @param null|array|string $opts |
| 15 |
* |
| 16 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 17 |
* |
| 18 |
* @return static the deleted resource |
| 19 |
*/ |
| 20 |
public function delete($params = null, $opts = null) |
| 21 |
{ |
| 22 |
self::_validateParams($params); |
| 23 |
|
| 24 |
$url = $this->instanceUrl(); |
| 25 |
list($response, $opts) = $this->_request('delete', $url, $params, $opts); |
| 26 |
$this->refreshFrom($response, $opts); |
| 27 |
|
| 28 |
return $this; |
| 29 |
} |
| 30 |
} |
| 31 |
|