@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | return array( |
| 12 | 12 | 'curl' => array( |
| 13 | 13 | CURLOPT_HTTPAUTH => CURLAUTH_BASIC | CURLAUTH_NTLM, |
| 14 | - CURLOPT_USERPWD => $username . ':' . $password |
|
| 14 | + CURLOPT_USERPWD => $username.':'.$password |
|
| 15 | 15 | ) |
| 16 | 16 | ); |
| 17 | 17 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | return array( |
| 22 | 22 | 'headers' => array( |
| 23 | - 'Authorization' => 'Bearer ' . $token |
|
| 23 | + 'Authorization' => 'Bearer '.$token |
|
| 24 | 24 | ) |
| 25 | 25 | ); |
| 26 | 26 | } |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | private $shutdownRegistered = false; |
| 22 | 22 | |
| 23 | - private static $instances = [ ]; |
|
| 23 | + private static $instances = []; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @var Client |
| 27 | 27 | */ |
| 28 | 28 | private $client; |
| 29 | 29 | |
| 30 | - public static function getInstance($options = [ ]) |
|
| 30 | + public static function getInstance($options = []) |
|
| 31 | 31 | { |
| 32 | 32 | foreach (self::$instances as $instance) { |
| 33 | 33 | if ($instance['options'] == $options) { |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $dirPos = strrpos($dir, "src/API"); |
| 120 | 120 | $dir = substr($dir, 0, $dirPos); |
| 121 | 121 | |
| 122 | - $this->recordLocation = $dir . 'Resources/recordings/'; |
|
| 122 | + $this->recordLocation = $dir.'Resources/recordings/'; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $this->recordLocation; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | public function getRecordFilePath() |
| 129 | 129 | { |
| 130 | - $path = $this->getRecordLocation() . $this->recordFileName; |
|
| 130 | + $path = $this->getRecordLocation().$this->recordFileName; |
|
| 131 | 131 | $path = str_replace("\\", "/", $path); |
| 132 | 132 | return $path; |
| 133 | 133 | } |
@@ -23,12 +23,12 @@ |
||
| 23 | 23 | //should have your own way to get it, but just for the sake of example I'm going to show you a way to do that |
| 24 | 24 | |
| 25 | 25 | if (!$_SESSION['token'] && !isset($_GET)) { |
| 26 | - $redirect = $authorizationEndpoint . |
|
| 27 | - '?response_type=code' . |
|
| 28 | - '&client_id=' . urlencode($clientId) . |
|
| 29 | - '&redirect_uri=' . urlencode($redirectUri) . |
|
| 30 | - '&resource=' . urlencode($resource) . |
|
| 31 | - '&scope=' . urlencode('full_access_as_user'); |
|
| 26 | + $redirect = $authorizationEndpoint. |
|
| 27 | + '?response_type=code'. |
|
| 28 | + '&client_id='.urlencode($clientId). |
|
| 29 | + '&redirect_uri='.urlencode($redirectUri). |
|
| 30 | + '&resource='.urlencode($resource). |
|
| 31 | + '&scope='.urlencode('full_access_as_user'); |
|
| 32 | 32 | header("Location: {$redirect}"); |
| 33 | 33 | exit(); |
| 34 | 34 | } |
@@ -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 | { |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $server, |
| 199 | 199 | $username, |
| 200 | 200 | $password, |
| 201 | - $options = [ ] |
|
| 201 | + $options = [] |
|
| 202 | 202 | ) { |
| 203 | 203 | $this->setClient(ExchangeWebServices::fromUsernameAndPassword( |
| 204 | 204 | $server, |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | )); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - public static function withUsernameAndPassword($server, $username, $password, $options = [ ]) |
|
| 211 | + public static function withUsernameAndPassword($server, $username, $password, $options = []) |
|
| 212 | 212 | { |
| 213 | 213 | return new static(ExchangeWebServices::fromUsernameAndPassword( |
| 214 | 214 | $server, |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | )); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - public static function withCallbackToken($server, $token, $options = [ ]) |
|
| 221 | + public static function withCallbackToken($server, $token, $options = []) |
|
| 222 | 222 | { |
| 223 | 223 | return new static(ExchangeWebServices::fromCallbackToken( |
| 224 | 224 | $server, |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | { |
| 579 | 579 | $result = $this->getClient()->ConvertId(array( |
| 580 | 580 | 'DestinationFormat' => $destinationType, |
| 581 | - 'SourceIds' => array ( |
|
| 581 | + 'SourceIds' => array( |
|
| 582 | 582 | 'AlternateId' => array( |
| 583 | 583 | 'Format' => $fromType, |
| 584 | 584 | 'Id' => $itemId->getId(), |
@@ -35,7 +35,7 @@ |
||
| 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 | { |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | $api = API::withUsernameAndPassword('server', 'username', 'password'); |
| 6 | 6 | |
| 7 | -$api->createContacts(array ( |
|
| 7 | +$api->createContacts(array( |
|
| 8 | 8 | 'GivenName' => 'John', |
| 9 | 9 | 'Surname' => 'Smith', |
| 10 | 10 | 'EmailAddresses' => array( |
@@ -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 | ) |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | protected function createClient($server, $auth, $options) |
| 213 | 213 | { |
| 214 | - $location = 'https://' . $this->cleanServerUrl($server) . '/EWS/Exchange.asmx'; |
|
| 214 | + $location = 'https://'.$this->cleanServerUrl($server).'/EWS/Exchange.asmx'; |
|
| 215 | 215 | |
| 216 | 216 | $options = array_replace_recursive([ |
| 217 | 217 | 'version' => self::VERSION_2007, |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $this->soap = new NTLMSoapClient( |
| 225 | 225 | $location, |
| 226 | 226 | $auth, |
| 227 | - dirname(__FILE__) . '/../../Resources/wsdl/services.wsdl', |
|
| 227 | + dirname(__FILE__).'/../../Resources/wsdl/services.wsdl', |
|
| 228 | 228 | $options |
| 229 | 229 | ); |
| 230 | 230 | |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | |
| 294 | 294 | $server = $url['host']; |
| 295 | 295 | if (isset($url['port'])) { |
| 296 | - $server .= ':' . $url['port']; |
|
| 296 | + $server .= ':'.$url['port']; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | if (isset($url['path'])) { |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | // If the soap call failed then we need to thow an exception. |
| 319 | 319 | $code = $this->getClient()->getResponseCode(); |
| 320 | 320 | if ($code != 200) { |
| 321 | - throw new \jamesiarmes\PEWS\API\Exception('SOAP client returned status of ' . $code, $code); |
|
| 321 | + throw new \jamesiarmes\PEWS\API\Exception('SOAP client returned status of '.$code, $code); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | if (empty($response) || |