@@ -110,6 +110,9 @@ discard block |
||
110 | 110 | return $this->unIndexedFieldUris[$fieldName][$preference]; |
111 | 111 | } |
112 | 112 | |
113 | + /** |
|
114 | + * @param string $fieldName |
|
115 | + */ |
|
113 | 116 | public function getIndexedFieldUriByName($fieldName, $preference = 'item') |
114 | 117 | { |
115 | 118 | $fieldName = strtolower($fieldName); |
@@ -248,7 +251,7 @@ discard block |
||
248 | 251 | * |
249 | 252 | * @param $items |
250 | 253 | * @param array $options |
251 | - * @return API\CreateItemResponseType |
|
254 | + * @return Type |
|
252 | 255 | */ |
253 | 256 | public function createItems($items, $options = array()) |
254 | 257 | { |
@@ -283,6 +286,10 @@ discard block |
||
283 | 286 | return $this->getClient()->UpdateItem($request)->getItems(); |
284 | 287 | } |
285 | 288 | |
289 | + /** |
|
290 | + * @param string $itemType |
|
291 | + * @param string $uriType |
|
292 | + */ |
|
286 | 293 | protected function buildUpdateItemChanges($itemType, $uriType, $changes) |
287 | 294 | { |
288 | 295 | $setItemFields = array(); |
@@ -404,7 +411,7 @@ discard block |
||
404 | 411 | |
405 | 412 | /** |
406 | 413 | * @param $identifier |
407 | - * @return Type\BaseFolderType |
|
414 | + * @return Type |
|
408 | 415 | */ |
409 | 416 | public function getFolder($identifier) |
410 | 417 | { |
@@ -424,7 +431,7 @@ discard block |
||
424 | 431 | * Get a folder by it's distinguishedId |
425 | 432 | * |
426 | 433 | * @param string $distinguishedId |
427 | - * @return Type\BaseFolderType |
|
434 | + * @return Type |
|
428 | 435 | */ |
429 | 436 | public function getFolderByDistinguishedId($distinguishedId) |
430 | 437 | { |
@@ -438,7 +445,7 @@ discard block |
||
438 | 445 | |
439 | 446 | /** |
440 | 447 | * @param $folderId |
441 | - * @return Type\BaseFolderType |
|
448 | + * @return Type |
|
442 | 449 | */ |
443 | 450 | public function getFolderByFolderId($folderId) |
444 | 451 | { |
@@ -478,7 +485,7 @@ discard block |
||
478 | 485 | } |
479 | 486 | |
480 | 487 | /** |
481 | - * @param $folderName |
|
488 | + * @param string $folderName |
|
482 | 489 | * @param string|Type\FolderIdType $parentFolderId |
483 | 490 | * @param array $options |
484 | 491 | * @return bool|Type\BaseFolderType |
@@ -523,7 +530,7 @@ discard block |
||
523 | 530 | * @param Type\FolderIdType $folderId |
524 | 531 | * @param null $syncState |
525 | 532 | * @param array $options |
526 | - * @return SyncFolderItemsResponseMessageType |
|
533 | + * @return Type |
|
527 | 534 | */ |
528 | 535 | public function listItemChanges($folderId, $syncState = null, $options = array()) |
529 | 536 | { |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $server, |
223 | 223 | $username, |
224 | 224 | $password, |
225 | - $options = [ ] |
|
225 | + $options = [] |
|
226 | 226 | ) { |
227 | 227 | $this->setClient(ExchangeWebServices::fromUsernameAndPassword( |
228 | 228 | $server, |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | )); |
233 | 233 | } |
234 | 234 | |
235 | - public static function withUsernameAndPassword($server, $username, $password, $options = [ ]) |
|
235 | + public static function withUsernameAndPassword($server, $username, $password, $options = []) |
|
236 | 236 | { |
237 | 237 | return new static(ExchangeWebServices::fromUsernameAndPassword( |
238 | 238 | $server, |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | )); |
243 | 243 | } |
244 | 244 | |
245 | - public static function withCallbackToken($server, $token, $options = [ ]) |
|
245 | + public static function withCallbackToken($server, $token, $options = []) |
|
246 | 246 | { |
247 | 247 | return new static(ExchangeWebServices::fromCallbackToken( |
248 | 248 | $server, |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | |
393 | 393 | $newValue = []; |
394 | 394 | foreach ($value[$fieldKey]['Entry'] as $key => $updateValue) { |
395 | - $newValue[] = [$fieldKey => ['Entry' => ['Key' => $entryKey, $key => $updateValue ]]]; |
|
395 | + $newValue[] = [$fieldKey => ['Entry' => ['Key' => $entryKey, $key => $updateValue]]]; |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | $value = $newValue; |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | { |
662 | 662 | $result = $this->getClient()->ConvertId(array( |
663 | 663 | 'DestinationFormat' => $destinationType, |
664 | - 'SourceIds' => array ( |
|
664 | + 'SourceIds' => array( |
|
665 | 665 | 'AlternateId' => array( |
666 | 666 | 'Format' => $fromType, |
667 | 667 | 'Id' => $itemId->getId(), |
@@ -17,13 +17,13 @@ |
||
17 | 17 | //Phone numbers have to be updated in the same manner |
18 | 18 | $api->updateContactItem($contact[0]->getItemId(), array( |
19 | 19 | 'GivenName' => 'Jane', |
20 | - 'EmailAddress:EmailAddress1' => array ( |
|
21 | - 'EmailAddresses' => array ( |
|
20 | + 'EmailAddress:EmailAddress1' => array( |
|
21 | + 'EmailAddresses' => array( |
|
22 | 22 | 'Entry' => array('Key' => 'EmailAddress1', '_value' => '[email protected]') |
23 | 23 | ) |
24 | 24 | ), |
25 | - 'PhoneNumber:HomePhone' => array ( |
|
26 | - 'PhoneNumbers' => array ( |
|
25 | + 'PhoneNumber:HomePhone' => array( |
|
26 | + 'PhoneNumbers' => array( |
|
27 | 27 | 'Entry' => array('Key' => 'HomePhone', '_value' => '111') |
28 | 28 | ) |
29 | 29 | ) |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | protected function createClient($server, $auth, $options) |
217 | 217 | { |
218 | - $location = 'https://' . $this->cleanServerUrl($server) . '/EWS/Exchange.asmx'; |
|
218 | + $location = 'https://'.$this->cleanServerUrl($server).'/EWS/Exchange.asmx'; |
|
219 | 219 | |
220 | 220 | $options = array_replace_recursive([ |
221 | 221 | 'version' => self::VERSION_2007, |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $this->soap = new NTLMSoapClient( |
229 | 229 | $location, |
230 | 230 | $auth, |
231 | - dirname(__FILE__) . '/../../Resources/wsdl/services.wsdl', |
|
231 | + dirname(__FILE__).'/../../Resources/wsdl/services.wsdl', |
|
232 | 232 | $options |
233 | 233 | ); |
234 | 234 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | $server = $url['host']; |
299 | 299 | if (isset($url['port'])) { |
300 | - $server .= ':' . $url['port']; |
|
300 | + $server .= ':'.$url['port']; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | if (isset($url['path'])) { |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | |
332 | 332 | if ($code != 200) { |
333 | - throw new ExchangeException('SOAP client returned status of ' . $code, $code); |
|
333 | + throw new ExchangeException('SOAP client returned status of '.$code, $code); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | if (empty($response) || |
@@ -3,7 +3,6 @@ |
||
3 | 3 | require_once "vendor/autoload.php"; |
4 | 4 | |
5 | 5 | use garethp\ews\API\Type; |
6 | -use garethp\ews\Mail\MailAPI; |
|
7 | 6 | |
8 | 7 | $api = MailApi::withUsernameAndPassword('server', 'username', 'password'); |
9 | 8 |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | require_once "vendor/autoload.php"; |
4 | 4 | |
5 | -use garethp\ews\API\Type; |
|
6 | 5 | use garethp\ews\Mail\MailAPI; |
7 | 6 | |
8 | 7 | $api = MailAPI::withUsernameAndPassword('server', 'username', 'password'); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * @param Type\FolderIdType $folderId |
37 | 37 | * @param array $options |
38 | - * @return Type\ContactItemType[] |
|
38 | + * @return Type |
|
39 | 39 | */ |
40 | 40 | public function getContacts($folderId = null, $options = array()) |
41 | 41 | { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @param Type\ItemIdType $itemId |
65 | - * @return Type\ContactItemType |
|
65 | + * @return Type |
|
66 | 66 | */ |
67 | 67 | public function getContact($itemId) |
68 | 68 | { |
@@ -7,7 +7,7 @@ |
||
7 | 7 | $contact = $api->getContacts(); |
8 | 8 | |
9 | 9 | $api->updateContactItem($contact[0]->getItemId(), array( |
10 | - 'deleteFields' => array ( |
|
10 | + 'deleteFields' => array( |
|
11 | 11 | 'GivenName', |
12 | 12 | 'PhoneNumber:HomePhone' |
13 | 13 | ) |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $dirPos = strrpos($dir, "src/API"); |
135 | 135 | $dir = substr($dir, 0, $dirPos); |
136 | 136 | |
137 | - $this->recordLocation = $dir . 'Resources/recordings/'; |
|
137 | + $this->recordLocation = $dir.'Resources/recordings/'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | return $this->recordLocation; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | public function getRecordFilePath() |
144 | 144 | { |
145 | - $path = $this->getRecordLocation() . $this->recordFileName; |
|
145 | + $path = $this->getRecordLocation().$this->recordFileName; |
|
146 | 146 | $path = str_replace("\\", "/", $path); |
147 | 147 | |
148 | 148 | return $path; |
@@ -66,6 +66,11 @@ discard block |
||
66 | 66 | return constant(ExchangeWebServices::class . "::$constant"); |
67 | 67 | } |
68 | 68 | |
69 | + /** |
|
70 | + * @param string $email |
|
71 | + * @param string $password |
|
72 | + * @param string $username |
|
73 | + */ |
|
69 | 74 | protected function newAPI($email, $password, $username = null, $options = []) |
70 | 75 | { |
71 | 76 | $options = array_replace_recursive([ |
@@ -347,8 +352,8 @@ discard block |
||
347 | 352 | /** |
348 | 353 | * Get a top level domain based on an email address |
349 | 354 | * |
350 | - * @param $email |
|
351 | - * @return bool|string |
|
355 | + * @param string $email |
|
356 | + * @return string|false |
|
352 | 357 | */ |
353 | 358 | protected function getTopLevelDomainFromEmail($email) |
354 | 359 | { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $constant .= "_SP$minorVersion"; |
64 | 64 | } |
65 | 65 | |
66 | - return constant(ExchangeWebServices::class . "::$constant"); |
|
66 | + return constant(ExchangeWebServices::class."::$constant"); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | protected function newAPI($email, $password, $username = null, $options = []) |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | protected function tryTopLevelDomain($email, $password, $username) |
184 | 184 | { |
185 | 185 | $topLevelDomain = $this->getTopLevelDomainFromEmail($email); |
186 | - $url = 'https://www.' . $topLevelDomain . $this->autodiscoverPath; |
|
186 | + $url = 'https://www.'.$topLevelDomain.$this->autodiscoverPath; |
|
187 | 187 | |
188 | 188 | return $this->doNTLMPost($url, $email, $password, $username); |
189 | 189 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | protected function tryAutoDiscoverSubDomain($email, $password, $username) |
202 | 202 | { |
203 | 203 | $topLevelDomain = $this->getTopLevelDomainFromEmail($email); |
204 | - $url = 'https://autodiscover.' . $topLevelDomain . $this->autodiscoverPath; |
|
204 | + $url = 'https://autodiscover.'.$topLevelDomain.$this->autodiscoverPath; |
|
205 | 205 | |
206 | 206 | return $this->doNTLMPost($url, $email, $password, $username); |
207 | 207 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | { |
221 | 221 | $topLevelDomain = $this->getTopLevelDomainFromEmail($email); |
222 | 222 | |
223 | - $url = 'http://autodiscover.' . $topLevelDomain . $this->autodiscoverPath; |
|
223 | + $url = 'http://autodiscover.'.$topLevelDomain.$this->autodiscoverPath; |
|
224 | 224 | |
225 | 225 | $client = $this->httpPlayback->getHttpClient(); |
226 | 226 | $postOptions = [ |
@@ -258,11 +258,11 @@ discard block |
||
258 | 258 | protected function trySRVRecord($email, $password, $username) |
259 | 259 | { |
260 | 260 | $topLevelDomain = $this->getTopLevelDomainFromEmail($email); |
261 | - $srvHost = '_autodiscover._tcp.' . $topLevelDomain; |
|
261 | + $srvHost = '_autodiscover._tcp.'.$topLevelDomain; |
|
262 | 262 | $lookup = dns_get_record($srvHost, DNS_SRV); |
263 | 263 | if (sizeof($lookup) > 0) { |
264 | 264 | $host = $lookup[0]['target']; |
265 | - $url = 'https://' . $host . $this->autodiscoverPath; |
|
265 | + $url = 'https://'.$host.$this->autodiscoverPath; |
|
266 | 266 | |
267 | 267 | return $this->doNTLMPost($url, $email, $password, $username); |
268 | 268 | } |