1 | <?php |
||
16 | trait Followable |
||
17 | { |
||
18 | use HandlesRequest, HasEntityIdName; |
||
19 | |||
20 | /** |
||
21 | * Follow user by user_id. |
||
22 | * |
||
23 | * @param $entityId |
||
24 | * |
||
25 | * @return bool |
||
26 | */ |
||
27 | public function follow($entityId) |
||
31 | |||
32 | /** |
||
33 | * UnFollow user by user_id. |
||
34 | * |
||
35 | * @param $entityId |
||
36 | * |
||
37 | * @return bool |
||
38 | */ |
||
39 | public function unFollow($entityId) |
||
43 | |||
44 | /** |
||
45 | * Make api call for follow/unFollow a entity (user/board). |
||
46 | * |
||
47 | * @param int $entityId |
||
48 | * @param string $resourceUrl |
||
49 | * |
||
50 | * @return bool |
||
51 | */ |
||
52 | protected function followCall($entityId, $resourceUrl) |
||
59 | |||
60 | /** |
||
61 | * @param integer $entityId |
||
62 | * @return mixed |
||
63 | */ |
||
64 | public function createFollowRequestQuery($entityId) |
||
82 | |||
83 | /** |
||
84 | * Get followers. |
||
85 | * |
||
86 | * @param string $for |
||
87 | * @param int $limit |
||
88 | * |
||
89 | * @return Iterator |
||
90 | */ |
||
91 | public function followers($for, $limit = 0) |
||
97 | |||
98 | /** |
||
99 | * @param array $data |
||
100 | * @param string $resourceUrl |
||
101 | * @param int $limit |
||
102 | * |
||
103 | * @return Iterator |
||
104 | */ |
||
105 | public function getFollowData($data, $resourceUrl, $limit = 0) |
||
111 | |||
112 | /** |
||
113 | * @param array $params |
||
114 | * @param int $limit |
||
115 | * @param string $method |
||
116 | * @return mixed |
||
117 | */ |
||
118 | abstract protected function getPaginatedResponse(array $params, $limit, $method = 'getPaginatedData'); |
||
119 | |||
120 | /** |
||
121 | * @return string |
||
122 | */ |
||
123 | protected function getFollowUrl() |
||
127 | |||
128 | /** |
||
129 | * @return string |
||
130 | */ |
||
131 | protected function getUnFollowUrl() |
||
135 | |||
136 | /** |
||
137 | * @return string |
||
138 | */ |
||
139 | protected function getFollowersUrl() |
||
143 | |||
144 | /** |
||
145 | * @return string |
||
146 | */ |
||
147 | protected function getFollowersFor() |
||
151 | } |
||
152 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: