1 <?php
2
3 namespace PayPal\Api;
4
5 use PayPal\Common\PayPalModel;
6
7 /**
8 * Class WebhookEventList
9 *
10 * List of webhooks events.
11 *
12 * @package PayPal\Api
13 *
14 * @property \PayPal\Api\WebhookEvent[] events
15 * @property int count
16 * @property \PayPal\Api\Links[] links
17 */
18 class WebhookEventList extends PayPalModel
19 {
20 /**
21 * A list of webhooks events.
22 *
23 * @param \PayPal\Api\WebhookEvent[] $events
24 *
25 * @return $this
26 */
27 public function setEvents($events)
28 {
29 $this->events = $events;
30 return $this;
31 }
32
33 /**
34 * A list of webhooks events.
35 *
36 * @return \PayPal\Api\WebhookEvent[]
37 */
38 public function getEvents()
39 {
40 return $this->events;
41 }
42
43 /**
44 * Append Events to the list.
45 *
46 * @param \PayPal\Api\WebhookEvent $webhookEvent
47 * @return $this
48 */
49 public function addEvent($webhookEvent)
50 {
51 if (!$this->getEvents()) {
52 return $this->setEvents(array($webhookEvent));
53 } else {
54 return $this->setEvents(
55 array_merge($this->getEvents(), array($webhookEvent))
56 );
57 }
58 }
59
60 /**
61 * Remove Events from the list.
62 *
63 * @param \PayPal\Api\WebhookEvent $webhookEvent
64 * @return $this
65 */
66 public function removeEvent($webhookEvent)
67 {
68 return $this->setEvents(
69 array_diff($this->getEvents(), array($webhookEvent))
70 );
71 }
72
73 /**
74 * The number of items in each range of results. Note that the response might have fewer items than the requested `page_size` value.
75 *
76 * @param int $count
77 *
78 * @return $this
79 */
80 public function setCount($count)
81 {
82 $this->count = $count;
83 return $this;
84 }
85
86 /**
87 * The number of items in each range of results. Note that the response might have fewer items than the requested `page_size` value.
88 *
89 * @return int
90 */
91 public function getCount()
92 {
93 return $this->count;
94 }
95
96 /**
97 * Sets Links
98 *
99 * @param \PayPal\Api\Links[] $links
100 *
101 * @return $this
102 */
103 public function setLinks($links)
104 {
105 $this->links = $links;
106 return $this;
107 }
108
109 /**
110 * Gets Links
111 *
112 * @return \PayPal\Api\Links[]
113 */
114 public function getLinks()
115 {
116 return $this->links;
117 }
118
119 /**
120 * Append Links to the list.
121 *
122 * @param \PayPal\Api\Links $links
123 * @return $this
124 */
125 public function addLink($links)
126 {
127 if (!$this->getLinks()) {
128 return $this->setLinks(array($links));
129 } else {
130 return $this->setLinks(
131 array_merge($this->getLinks(), array($links))
132 );
133 }
134 }
135
136 /**
137 * Remove Links from the list.
138 *
139 * @param \PayPal\Api\Links $links
140 * @return $this
141 */
142 public function removeLink($links)
143 {
144 return $this->setLinks(
145 array_diff($this->getLinks(), array($links))
146 );
147 }
148
149 }
150