PlanList.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <?php
  2. namespace PayPal\Api;
  3. use PayPal\Common\PayPalModel;
  4. /**
  5. * Class PlanList
  6. *
  7. * Resource representing a list of billing plans with basic information and get link.
  8. *
  9. * @package PayPal\Api
  10. *
  11. * @property \PayPal\Api\Plan[] plans
  12. * @property string total_items
  13. * @property string total_pages
  14. * @property \PayPal\Api\Links[] links
  15. */
  16. class PlanList extends PayPalModel
  17. {
  18. /**
  19. * Array of billing plans.
  20. *
  21. * @param \PayPal\Api\Plan[] $plans
  22. *
  23. * @return $this
  24. */
  25. public function setPlans($plans)
  26. {
  27. $this->plans = $plans;
  28. return $this;
  29. }
  30. /**
  31. * Array of billing plans.
  32. *
  33. * @return \PayPal\Api\Plan[]
  34. */
  35. public function getPlans()
  36. {
  37. return $this->plans;
  38. }
  39. /**
  40. * Append Plans to the list.
  41. *
  42. * @param \PayPal\Api\Plan $plan
  43. * @return $this
  44. */
  45. public function addPlan($plan)
  46. {
  47. if (!$this->getPlans()) {
  48. return $this->setPlans(array($plan));
  49. } else {
  50. return $this->setPlans(
  51. array_merge($this->getPlans(), array($plan))
  52. );
  53. }
  54. }
  55. /**
  56. * Remove Plans from the list.
  57. *
  58. * @param \PayPal\Api\Plan $plan
  59. * @return $this
  60. */
  61. public function removePlan($plan)
  62. {
  63. return $this->setPlans(
  64. array_diff($this->getPlans(), array($plan))
  65. );
  66. }
  67. /**
  68. * Total number of items.
  69. *
  70. * @param string $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.
  81. *
  82. * @return string
  83. */
  84. public function getTotalItems()
  85. {
  86. return $this->total_items;
  87. }
  88. /**
  89. * Total number of pages.
  90. *
  91. * @param string $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.
  102. *
  103. * @return string
  104. */
  105. public function getTotalPages()
  106. {
  107. return $this->total_pages;
  108. }
  109. /**
  110. * Sets Links
  111. *
  112. * @param \PayPal\Api\Links[] $links
  113. *
  114. * @return $this
  115. */
  116. public function setLinks($links)
  117. {
  118. $this->links = $links;
  119. return $this;
  120. }
  121. /**
  122. * Gets Links
  123. *
  124. * @return \PayPal\Api\Links[]
  125. */
  126. public function getLinks()
  127. {
  128. return $this->links;
  129. }
  130. /**
  131. * Append Links to the list.
  132. *
  133. * @param \PayPal\Api\Links $links
  134. * @return $this
  135. */
  136. public function addLink($links)
  137. {
  138. if (!$this->getLinks()) {
  139. return $this->setLinks(array($links));
  140. } else {
  141. return $this->setLinks(
  142. array_merge($this->getLinks(), array($links))
  143. );
  144. }
  145. }
  146. /**
  147. * Remove Links from the list.
  148. *
  149. * @param \PayPal\Api\Links $links
  150. * @return $this
  151. */
  152. public function removeLink($links)
  153. {
  154. return $this->setLinks(
  155. array_diff($this->getLinks(), array($links))
  156. );
  157. }
  158. }