1 | <?php |
||
12 | trait Modifiable |
||
13 | { |
||
14 | |||
15 | use ModifiesLabels { |
||
16 | ModifiesLabels::__construct as private __mlConstruct; |
||
17 | } |
||
18 | |||
19 | private $messageRequest; |
||
20 | |||
21 | public function __construct() |
||
22 | { |
||
23 | $this->__mlConstruct(); |
||
|
|||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Marks emails as "READ". Returns string of message if fail |
||
28 | * |
||
29 | * @return Mail|string |
||
30 | */ |
||
31 | public function markAsRead() |
||
39 | |||
40 | /** |
||
41 | * Marks emails as unread |
||
42 | * |
||
43 | * @return Mail|string |
||
44 | * @throws \Exception |
||
45 | */ |
||
46 | public function markAsUnread() |
||
54 | |||
55 | /** |
||
56 | * @return Mail|string |
||
57 | * @throws \Exception |
||
58 | */ |
||
59 | public function markAsImportant() |
||
67 | |||
68 | /** |
||
69 | * @return Mail|string |
||
70 | * @throws \Exception |
||
71 | */ |
||
72 | public function markAsNotImportant() |
||
80 | |||
81 | /** |
||
82 | * @return Mail|string |
||
83 | * @throws \Exception |
||
84 | */ |
||
85 | public function addStar() |
||
93 | |||
94 | /** |
||
95 | * @return Mail|string |
||
96 | * @throws \Exception |
||
97 | */ |
||
98 | public function removeStar() |
||
106 | |||
107 | /** |
||
108 | * Send the email to the trash |
||
109 | * |
||
110 | * @return \Dacastro4\LaravelGmail\Services\Message\Mail|\Exception |
||
111 | */ |
||
112 | public function sendToTrash() |
||
120 | |||
121 | public function removeFromTrash() |
||
129 | } |
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.