1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace garethp\ews\API\ExchangeWebServices; |
4
|
|
|
|
5
|
|
|
use garethp\ews\API\MiddlewareRequest; |
6
|
|
|
use garethp\ews\API\MiddlewareResponse; |
7
|
|
|
use garethp\ews\API\Type; |
8
|
|
|
use garethp\ews\API\ExchangeWebServices; |
9
|
|
|
use garethp\ews\API\Type\FindFolderParentType; |
10
|
|
|
use garethp\ews\API\Type\FindItemParentType; |
11
|
|
|
|
12
|
|
|
class MiddlewareFactory |
13
|
|
|
{ |
14
|
28 |
|
public function getSoapCall() |
15
|
|
|
{ |
16
|
|
|
return function (MiddlewareRequest $request) { |
17
|
28 |
|
$client = $this->getClient(); |
|
|
|
|
18
|
28 |
|
$response = $client->__call($request->getName(), $request->getArguments()); |
19
|
28 |
|
$response = MiddlewareResponse::newResponse($response); |
20
|
|
|
|
21
|
28 |
|
return $response; |
22
|
1 |
|
}; |
23
|
|
|
} |
24
|
|
|
|
25
|
28 |
|
public function getTypeToXMLObject() |
26
|
|
|
{ |
27
|
|
|
return function (MiddlewareRequest $request, callable $next) { |
28
|
28 |
|
if ($request->getRequest() instanceof Type) { |
29
|
28 |
|
$request->setRequest($request->getRequest()->toXmlObject()); |
30
|
28 |
|
} |
31
|
|
|
|
32
|
28 |
|
return $next($request); |
33
|
1 |
|
}; |
34
|
|
|
} |
35
|
|
|
|
36
|
28 |
|
public function getStripSyncScopeForExchange2007() |
37
|
|
|
{ |
38
|
|
|
return function (MiddlewareRequest $request, callable $next) { |
39
|
28 |
|
$options = $request->getOptions(); |
40
|
28 |
|
$version2007SP1 = ($options['version'] == ExchangeWebServices::VERSION_2007 |
41
|
28 |
|
|| $options['version'] == ExchangeWebServices::VERSION_2007_SP1); |
42
|
|
|
|
43
|
28 |
|
$requestObj = $request->getName(); |
44
|
|
|
|
45
|
28 |
|
if ($request->getName() == "SyncFolderItems" && $version2007SP1 && isset($requestObj->SyncScope)) { |
46
|
|
|
unset($requestObj->SyncScope); |
47
|
|
|
$request->setRequest($requestObj); |
48
|
|
|
} |
49
|
|
|
|
50
|
28 |
|
return $next($request); |
51
|
1 |
|
}; |
52
|
|
|
} |
53
|
|
|
|
54
|
28 |
|
public function getProcessResponse() |
55
|
|
|
{ |
56
|
|
|
return function (MiddlewareRequest $request, callable $next) { |
57
|
28 |
|
$response = $next($request); |
58
|
|
|
|
59
|
28 |
|
$response->setResponse($this->processResponse($response->getResponse())); |
|
|
|
|
60
|
|
|
|
61
|
28 |
|
return $response; |
62
|
1 |
|
}; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function getAddLastRequestToPagedResults() |
66
|
|
|
{ |
67
|
28 |
|
return function (MiddlewareRequest $request, callable $next) { |
68
|
28 |
|
$response = $next($request); |
69
|
|
|
|
70
|
28 |
|
$responseObject = $response->getResponse(); |
71
|
|
|
if (($responseObject instanceof FindItemParentType |
|
|
|
|
72
|
28 |
|
|| $responseObject instanceof FindFolderParentType) |
|
|
|
|
73
|
28 |
|
&& !$responseObject->isIncludesLastItemInRange()) { |
74
|
1 |
|
$responseObject->setLastRequest($request->getRequest()); |
75
|
1 |
|
$response->setResponse($responseObject); |
76
|
1 |
|
} |
77
|
|
|
|
78
|
28 |
|
return $response; |
79
|
1 |
|
}; |
80
|
|
|
} |
81
|
|
|
} |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.