1 | <?php |
||
34 | class Notifications { |
||
35 | const RESPONSE_FORMAT = 'json'; // default response format for ocs calls |
||
36 | |||
37 | /** @var AddressHandler */ |
||
38 | private $addressHandler; |
||
39 | |||
40 | /** @var IClientService */ |
||
41 | private $httpClientService; |
||
42 | |||
43 | /** @var DiscoveryManager */ |
||
44 | private $discoveryManager; |
||
45 | 1 | ||
46 | /** @var IJobList */ |
||
47 | private $jobList; |
||
48 | |||
49 | 1 | /** @var IConfig */ |
|
50 | 1 | private $config; |
|
51 | 1 | ||
52 | /** |
||
53 | * @param AddressHandler $addressHandler |
||
54 | * @param IClientService $httpClientService |
||
55 | * @param DiscoveryManager $discoveryManager |
||
56 | * @param IJobList $jobList |
||
57 | * @param IConfig $config |
||
58 | */ |
||
59 | public function __construct( |
||
72 | |||
73 | /** |
||
74 | * send server-to-server share to remote server |
||
75 | * |
||
76 | * @param Address $shareWithAddress |
||
77 | * @param Address $ownerAddress |
||
78 | * @param Address $sharedByAddress |
||
79 | * @param string $token |
||
80 | * @param string $shareWith |
||
|
|||
81 | * @param string $name |
||
82 | * @param int $remote_id |
||
83 | * |
||
84 | * @return bool |
||
85 | * |
||
86 | * @throws \OC\HintException |
||
87 | * @throws \OC\ServerNotAvailableException |
||
88 | */ |
||
89 | public function sendRemoteShare(Address $shareWithAddress, |
||
116 | |||
117 | /** |
||
118 | * ask owner to re-share the file with the given user |
||
119 | * |
||
120 | * @param string $token |
||
121 | * @param int $id remote Id |
||
122 | * @param int $shareId internal share Id |
||
123 | * @param string $remote remote address of the owner |
||
124 | * @param string $shareWith |
||
125 | * @param int $permission |
||
126 | * @return bool |
||
127 | * @throws \Exception |
||
128 | */ |
||
129 | public function requestReShare($token, $id, $shareId, $remote, $shareWith, $permission) { |
||
154 | |||
155 | /** |
||
156 | * send server-to-server unshare to remote server |
||
157 | * |
||
158 | * @param string $remote url |
||
159 | * @param int $id share id |
||
160 | * @param string $token |
||
161 | * @return bool |
||
162 | */ |
||
163 | public function sendRemoteUnShare($remote, $id, $token) { |
||
166 | |||
167 | /** |
||
168 | * send server-to-server unshare to remote server |
||
169 | * |
||
170 | * @param string $remote url |
||
171 | * @param int $id share id |
||
172 | * @param string $token |
||
173 | * @return bool |
||
174 | */ |
||
175 | public function sendRevokeShare($remote, $id, $token) { |
||
178 | |||
179 | /** |
||
180 | * send notification to remote server if the permissions was changed |
||
181 | * |
||
182 | * @param string $remote |
||
183 | * @param int $remoteId |
||
184 | * @param string $token |
||
185 | * @param int $permissions |
||
186 | * @return bool |
||
187 | */ |
||
188 | public function sendPermissionChange($remote, $remoteId, $token, $permissions) { |
||
191 | |||
192 | /** |
||
193 | * forward accept reShare to remote server |
||
194 | * |
||
195 | * @param string $remote |
||
196 | * @param int $remoteId |
||
197 | * @param string $token |
||
198 | */ |
||
199 | public function sendAcceptShare($remote, $remoteId, $token) { |
||
202 | |||
203 | /** |
||
204 | * forward decline reShare to remote server |
||
205 | * |
||
206 | * @param string $remote |
||
207 | * @param int $remoteId |
||
208 | * @param string $token |
||
209 | */ |
||
210 | public function sendDeclineShare($remote, $remoteId, $token) { |
||
213 | |||
214 | /** |
||
215 | * inform remote server whether server-to-server share was accepted/declined |
||
216 | * |
||
217 | * @param string $remote |
||
218 | * @param int $remoteId Share id on the remote host |
||
219 | * @param string $token |
||
220 | * @param string $action possible actions: |
||
221 | * accept, decline, unshare, revoke, permissions |
||
222 | * @param array $data |
||
223 | * @param int $try |
||
224 | * |
||
225 | * @return boolean |
||
226 | * |
||
227 | * @throws \Exception |
||
228 | */ |
||
229 | public function sendUpdateToRemote($remote, $remoteId, $token, $action, $data = [], $try = 0) { |
||
272 | |||
273 | /** |
||
274 | * return current timestamp |
||
275 | * |
||
276 | * @return int |
||
277 | */ |
||
278 | protected function getTimestamp() { |
||
281 | |||
282 | /** |
||
283 | * try http post first with https and then with http as a fallback |
||
284 | * |
||
285 | * @param string $remoteDomain |
||
286 | * @param string $urlSuffix |
||
287 | * @param array $fields post parameters |
||
288 | * @return array |
||
289 | * @throws \Exception |
||
290 | */ |
||
291 | protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields, $useOcm = false) { |
||
337 | |||
338 | protected function sendOcmRemoteShare(Address $shareWithAddress, Address $ownerAddress, Address $sharedByAddress, $token, $name, $remote_id) { |
||
365 | |||
366 | protected function sendPreOcmRemoteShare(Address $shareWithAddress, Address $ownerAddress, Address $sharedByAddress, $token, $name, $remote_id) { |
||
387 | |||
388 | /** |
||
389 | * Validate ocs response - 100 or 200 means success |
||
390 | * |
||
391 | * @param array $status |
||
392 | * |
||
393 | * @return bool |
||
394 | */ |
||
395 | private function isOcsStatusOk($status) { |
||
398 | } |
||
399 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.