CreditCardList.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. namespace PayPal\Api;
  3. use PayPal\Common\PayPalResourceModel;
  4. /**
  5. * Class CreditCardList
  6. *
  7. * A list of Credit Card Resources
  8. *
  9. * @package PayPal\Api
  10. *
  11. * @property \PayPal\Api\CreditCard[] items
  12. * @property \PayPal\Api\Links[] links
  13. * @property int total_items
  14. * @property int total_pages
  15. */
  16. class CreditCardList extends PayPalResourceModel
  17. {
  18. /**
  19. * A list of credit card resources
  20. *
  21. * @param \PayPal\Api\CreditCard[] $items
  22. *
  23. * @return $this
  24. */
  25. public function setItems($items)
  26. {
  27. $this->items = $items;
  28. return $this;
  29. }
  30. /**
  31. * A list of credit card resources
  32. *
  33. * @return \PayPal\Api\CreditCard[]
  34. */
  35. public function getItems()
  36. {
  37. return $this->items;
  38. }
  39. /**
  40. * Append Items to the list.
  41. *
  42. * @param \PayPal\Api\CreditCard $creditCard
  43. * @return $this
  44. */
  45. public function addItem($creditCard)
  46. {
  47. if (!$this->getItems()) {
  48. return $this->setItems(array($creditCard));
  49. } else {
  50. return $this->setItems(
  51. array_merge($this->getItems(), array($creditCard))
  52. );
  53. }
  54. }
  55. /**
  56. * Remove Items from the list.
  57. *
  58. * @param \PayPal\Api\CreditCard $creditCard
  59. * @return $this
  60. */
  61. public function removeItem($creditCard)
  62. {
  63. return $this->setItems(
  64. array_diff($this->getItems(), array($creditCard))
  65. );
  66. }
  67. /**
  68. * Total number of items present in the given list. Note that the number of items might be larger than the records in the current page.
  69. *
  70. * @param int $total_items
  71. *
  72. * @return $this
  73. */
  74. public function setTotalItems($total_items)
  75. {
  76. $this->total_items = $total_items;
  77. return $this;
  78. }
  79. /**
  80. * Total number of items present in the given list. Note that the number of items might be larger than the records in the current page.
  81. *
  82. * @return int
  83. */
  84. public function getTotalItems()
  85. {
  86. return $this->total_items;
  87. }
  88. /**
  89. * Total number of pages that exist, for the total number of items, with the given page size.
  90. *
  91. * @param int $total_pages
  92. *
  93. * @return $this
  94. */
  95. public function setTotalPages($total_pages)
  96. {
  97. $this->total_pages = $total_pages;
  98. return $this;
  99. }
  100. /**
  101. * Total number of pages that exist, for the total number of items, with the given page size.
  102. *
  103. * @return int
  104. */
  105. public function getTotalPages()
  106. {
  107. return $this->total_pages;
  108. }
  109. }