1 | <?php |
||
2 | |||
3 | namespace garethp\ews; |
||
4 | |||
5 | use garethp\ews\API\ClassMap; |
||
6 | use garethp\ews\API\Type\BaseFolderIdType; |
||
7 | use garethp\ews\API\Type\FolderIdType; |
||
8 | |||
9 | class NotificationAPI extends API |
||
10 | { |
||
11 | public function subscribeToPushNotifications( |
||
12 | BaseFolderIdType $folderId, |
||
13 | array $events, |
||
14 | $url, |
||
15 | $frequency, |
||
16 | array $options = array() |
||
17 | ) { |
||
18 | $request = [ |
||
19 | 'EventTypes' => ['EventType' => $events], |
||
20 | 'URL' => $url, |
||
21 | 'StatusFrequency' => $frequency, |
||
22 | 'FolderIds' => $folderId->toArray(true) |
||
23 | ]; |
||
24 | |||
25 | $request = array_replace_recursive($request, $options); |
||
26 | |||
27 | return $this->getClient()->Subscribe([ |
||
28 | 'PushSubscriptionRequest' => $request |
||
29 | ]); |
||
30 | } |
||
31 | |||
32 | public static function handlePullNotification($uri, callable $handle, array $options = array()) |
||
0 ignored issues
–
show
|
|||
33 | { |
||
34 | $server = new \SoapServer( |
||
35 | __DIR__ . '/../Resources/wsdl/notification-service.wsdl', |
||
36 | [ |
||
37 | 'uri' => $uri, |
||
38 | 'classmap' => ClassMap::getClassMap(), |
||
39 | ] |
||
40 | ); |
||
41 | $server->setObject(new NotificationHandler($handle)); |
||
42 | $server->handle(); |
||
43 | |||
44 | return $server; |
||
45 | } |
||
46 | } |
||
47 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.