1 | <?php |
||
7 | trait ManagesEvents |
||
8 | { |
||
9 | /** |
||
10 | * This value is unique to ActiveCampaign account and can be found named "Event Key" |
||
11 | * on Settings > Tracking > Event Tracking inside ActiveCampaign account. |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | public $eventKey; |
||
16 | |||
17 | /** |
||
18 | * This value is unique to ActiveCampaign account and can be found named "actid" |
||
19 | * on Settings > Tracking > Event Tracking API. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | public $actid; |
||
24 | |||
25 | /** |
||
26 | * Creates a new event (name only) |
||
27 | * |
||
28 | * @param string $name |
||
29 | * |
||
30 | * @return Event |
||
31 | */ |
||
32 | public function createEvent($name) |
||
42 | |||
43 | /** |
||
44 | * List all events |
||
45 | * |
||
46 | * @return Event[] |
||
47 | */ |
||
48 | public function events() |
||
56 | |||
57 | /** |
||
58 | * List name of all events |
||
59 | * |
||
60 | * @return Event[] |
||
61 | */ |
||
62 | public function eventNames() |
||
69 | |||
70 | /** |
||
71 | * Removes an existing event tracking event (name only) |
||
72 | * |
||
73 | * @param $name |
||
74 | * |
||
75 | * @throws \TestMonitor\ActiveCampaign\Exceptions\NotFoundException |
||
76 | */ |
||
77 | public function deleteEvent($name) |
||
81 | |||
82 | /** |
||
83 | * Tracks an event by name |
||
84 | * |
||
85 | * @param string $name name of the event to track |
||
86 | * @param string $email email address of the contact to track this event for, optional |
||
87 | * @param array $eventData a value to store for the event, optional |
||
88 | * |
||
89 | * @return bool TRUE on success, FALSE otherwise |
||
90 | * @throws \TestMonitor\ActiveCampaign\Exceptions\FailedActionException |
||
91 | */ |
||
92 | public function trackEvent($name, $email = '', $eventData = []) |
||
120 | } |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.