1 <?php
2
3 namespace PayPal\Api;
4
5 use PayPal\Common\PayPalModel;
6
7 /**
8 * Class WebhookEventTypeList
9 *
10 * List of webhook events.
11 *
12 * @package PayPal\Api
13 *
14 * @property \PayPal\Api\WebhookEventType[] event_types
15 */
16 class WebhookEventTypeList extends PayPalModel
17 {
18 /**
19 * A list of webhook events.
20 *
21 * @param \PayPal\Api\WebhookEventType[] $event_types
22 *
23 * @return $this
24 */
25 public function setEventTypes($event_types)
26 {
27 $this->event_types = $event_types;
28 return $this;
29 }
30
31 /**
32 * A list of webhook events.
33 *
34 * @return \PayPal\Api\WebhookEventType[]
35 */
36 public function getEventTypes()
37 {
38 return $this->event_types;
39 }
40
41 /**
42 * Append EventTypes to the list.
43 *
44 * @param \PayPal\Api\WebhookEventType $webhookEventType
45 * @return $this
46 */
47 public function addEventType($webhookEventType)
48 {
49 if (!$this->getEventTypes()) {
50 return $this->setEventTypes(array($webhookEventType));
51 } else {
52 return $this->setEventTypes(
53 array_merge($this->getEventTypes(), array($webhookEventType))
54 );
55 }
56 }
57
58 /**
59 * Remove EventTypes from the list.
60 *
61 * @param \PayPal\Api\WebhookEventType $webhookEventType
62 * @return $this
63 */
64 public function removeEventType($webhookEventType)
65 {
66 return $this->setEventTypes(
67 array_diff($this->getEventTypes(), array($webhookEventType))
68 );
69 }
70
71 }
72