All.php
4 years ago
Create.php
4 years ago
Delete.php
4 years ago
NestedResource.php
4 years ago
Request.php
2 years ago
Retrieve.php
4 years ago
Search.php
2 years ago
Update.php
4 years ago
Delete.php
31 lines
| 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 |