File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -439,19 +439,24 @@ public function unsubscribe($subscriptionArn) {
439439 * @param string $platformApplicationArn
440440 * @param string $token
441441 * @param string $userData
442- * @return bool
442+ * @return string
443443 * @throws InvalidArgumentException
444444 */
445- public function createPlatformEndpoint ($ platformApplicationArn , $ token , $ userData ) {
446- if (empty ($ platformApplicationArn ) || empty ($ token ) || empty ( $ userData ) ) {
447- throw new InvalidArgumentException ('Must supply a PlatformApplicationArn,Token & UserData to create platform endpoint ' );
445+ public function createPlatformEndpoint ($ platformApplicationArn , $ token , $ userData = null ) {
446+ if (empty ($ platformApplicationArn ) || empty ($ token )) {
447+ throw new InvalidArgumentException ('Must supply a PlatformApplicationArn & Token to create platform endpoint ' );
448448 }
449449
450- $ response = $ this -> _request ( ' CreatePlatformEndpoint ' , array (
450+ $ attributes = array (
451451 'PlatformApplicationArn ' => $ platformApplicationArn ,
452- 'Token ' => $ token ,
453- 'CustomUserData ' => $ userData
454- ));
452+ 'Token ' => $ token
453+ );
454+
455+ if (!empty ($ userData )) {
456+ $ attributes ['CustomUserData ' ] = $ userData ;
457+ }
458+
459+ $ response = $ this ->_request ('CreatePlatformEndpoint ' , $ attributes );
455460
456461 return strval ($ response ->CreatePlatformEndpointResult ->EndpointArn );
457462 }
You can’t perform that action at this time.
0 commit comments