SubscriptionItem.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class SubscriptionItem
  5. *
  6. * @package Stripe
  7. */
  8. class SubscriptionItem extends ApiResource
  9. {
  10. /**
  11. * This is a special case because the subscription items endpoint has an
  12. * underscore in it. The parent `className` function strips underscores.
  13. *
  14. * @return string The name of the class.
  15. */
  16. public static function className()
  17. {
  18. return 'subscription_item';
  19. }
  20. /**
  21. * @param string $id The ID of the subscription item to retrieve.
  22. * @param array|string|null $opts
  23. *
  24. * @return SubscriptionItem
  25. */
  26. public static function retrieve($id, $opts = null)
  27. {
  28. return self::_retrieve($id, $opts);
  29. }
  30. /**
  31. * @param array|null $params
  32. * @param array|string|null $opts
  33. *
  34. * @return Collection of SubscriptionItems
  35. */
  36. public static function all($params = null, $opts = null)
  37. {
  38. return self::_all($params, $opts);
  39. }
  40. /**
  41. * @param array|null $params
  42. * @param array|string|null $opts
  43. *
  44. * @return SubscriptionItem The created subscription item.
  45. */
  46. public static function create($params = null, $opts = null)
  47. {
  48. return self::_create($params, $opts);
  49. }
  50. /**
  51. * @param string $id The ID of the subscription item to update.
  52. * @param array|null $params
  53. * @param array|string|null $options
  54. *
  55. * @return SubscriptionItem The updated subscription item.
  56. */
  57. public static function update($id, $params = null, $options = null)
  58. {
  59. return self::_update($id, $params, $options);
  60. }
  61. /**
  62. * @param array|string|null $opts
  63. *
  64. * @return SubscriptionItem The saved subscription item.
  65. */
  66. public function save($opts = null)
  67. {
  68. return $this->_save($opts);
  69. }
  70. /**
  71. * @param array|null $params
  72. * @param array|string|null $opts
  73. *
  74. * @return SubscriptionItem The deleted subscription item.
  75. */
  76. public function delete($params = null, $opts = null)
  77. {
  78. return $this->_delete($params, $opts);
  79. }
  80. }