1 | <?php |
||
9 | trait TryIt |
||
10 | { |
||
11 | use HandlesRequest, UploadsImages; |
||
12 | |||
13 | /** |
||
14 | * Makes a DidIt activity record. |
||
15 | * |
||
16 | * @param string $pinId |
||
17 | * @param string $comment |
||
18 | * @param null|string $pathToImage |
||
19 | * @return array |
||
20 | */ |
||
21 | public function tryIt($pinId, $comment, $pathToImage = null) |
||
29 | |||
30 | /** |
||
31 | * @param string $pinId |
||
32 | * @param string $tryItRecordId |
||
33 | * @param string $comment |
||
34 | * @param string|null $pathToImage |
||
35 | * @return bool|Response |
||
36 | */ |
||
37 | public function editTryIt($pinId, $tryItRecordId, $comment, $pathToImage = null) |
||
44 | |||
45 | /** |
||
46 | * Get the pinners who have tied this pin |
||
47 | * |
||
48 | * @param string $pinId |
||
49 | * @param int $limit |
||
50 | * @return Pagination |
||
51 | */ |
||
52 | public function tried($pinId, $limit = Pagination::DEFAULT_LIMIT) |
||
61 | |||
62 | /** |
||
63 | * @param string $tryItRecordId |
||
64 | * @return bool|Response |
||
65 | */ |
||
66 | public function deleteTryIt($tryItRecordId) |
||
73 | |||
74 | /** |
||
75 | * @param string $pinId |
||
76 | * @param string $comment |
||
77 | * @param string|null $pathToImage |
||
78 | * @return array |
||
79 | */ |
||
80 | protected function makeRequest($pinId, $comment, $pathToImage = null) |
||
100 | } |
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.