1
|
|
|
<?php namespace Stevenmaguire\Uber\Resources; |
2
|
|
|
|
3
|
|
|
trait Reminders |
4
|
|
|
{ |
5
|
|
|
/** |
6
|
|
|
* Cancels a specific reminder. |
7
|
|
|
* |
8
|
|
|
* The Reminders endpoint allows you to remove any reminder in the pending |
9
|
|
|
* state from being sent. |
10
|
|
|
* |
11
|
|
|
* @param string $reminderId Reminder id |
12
|
|
|
* |
13
|
|
|
* @return stdClass The JSON response from the request |
14
|
|
|
* |
15
|
|
|
* @see https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-delete |
16
|
|
|
*/ |
17
|
2 |
|
public function cancelReminder($reminderId) |
18
|
|
|
{ |
19
|
2 |
|
return $this->request('delete', 'reminders/'.$reminderId); |
|
|
|
|
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Creates a new reminder. |
24
|
|
|
* |
25
|
|
|
* The Reminders endpoint allows developers to set a reminder for a future |
26
|
|
|
* trip. |
27
|
|
|
* |
28
|
|
|
* @param array $attributes Query attributes |
29
|
|
|
* |
30
|
|
|
* @return stdClass The JSON response from the request |
31
|
|
|
* |
32
|
|
|
* @see https://developer.uber.com/docs/riders/references/api/v1.2/reminders-post |
33
|
|
|
*/ |
34
|
2 |
|
public function createReminder($attributes) |
35
|
|
|
{ |
36
|
2 |
|
return $this->request('post', 'reminders', $attributes); |
|
|
|
|
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Fetches a specific reminder. |
41
|
|
|
* |
42
|
|
|
* The Reminders endpoint allows you to get the status of an existing ride |
43
|
|
|
* reminder. |
44
|
|
|
* |
45
|
|
|
* @param string $reminderId Reminder id |
46
|
|
|
* |
47
|
|
|
* @return stdClass The JSON response from the request |
48
|
|
|
* |
49
|
|
|
* @see https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-get |
50
|
|
|
*/ |
51
|
2 |
|
public function getReminder($reminderId) |
52
|
|
|
{ |
53
|
2 |
|
return $this->request('get', 'reminders/'.$reminderId); |
|
|
|
|
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Updates a specific reminder. |
58
|
|
|
* |
59
|
|
|
* The Reminders endpoint allows you to update an existing reminder. |
60
|
|
|
* |
61
|
|
|
* @param string $reminderId Reminder id |
62
|
|
|
* @param array $attributes Query attributes |
63
|
|
|
* |
64
|
|
|
* @return stdClass The JSON response from the request |
65
|
|
|
* |
66
|
|
|
* @see https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-patch |
67
|
|
|
*/ |
68
|
2 |
|
public function setReminder($reminderId, $attributes = []) |
69
|
|
|
{ |
70
|
2 |
|
return $this->request('put', 'reminders/'.$reminderId, $attributes); |
|
|
|
|
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|
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.