From 4a3189d1c46a014c32365523e0f18b91bca92ed4 Mon Sep 17 00:00:00 2001 From: yehudah Date: Tue, 21 Jan 2020 20:34:49 +0000 Subject: undefined notifications and version bump --- Postman/PostmanOAuthToken.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'Postman') diff --git a/Postman/PostmanOAuthToken.php b/Postman/PostmanOAuthToken.php index 1cd9634..81efbfe 100644 --- a/Postman/PostmanOAuthToken.php +++ b/Postman/PostmanOAuthToken.php @@ -45,10 +45,26 @@ if (! class_exists ( 'PostmanOAuthToken.php' )) { */ private function load() { $a = get_option ( PostmanOAuthToken::OPTIONS_NAME ); - $this->setAccessToken ( $a [PostmanOAuthToken::ACCESS_TOKEN] ); - $this->setRefreshToken ( $a [PostmanOAuthToken::REFRESH_TOKEN] ); - $this->setExpiryTime ( $a [PostmanOAuthToken::EXPIRY_TIME] ); - $this->setVendorName ( $a [PostmanOAuthToken::VENDOR_NAME] ); + + if ( ! is_array( $a ) ) { + return; + } + + if ( isset( $a [PostmanOAuthToken::ACCESS_TOKEN] ) ) { + $this->setAccessToken ( $a [PostmanOAuthToken::ACCESS_TOKEN] ); + } + + if ( isset( $a [PostmanOAuthToken::REFRESH_TOKEN] ) ) { + $this->setRefreshToken($a [PostmanOAuthToken::REFRESH_TOKEN]); + } + + if ( isset( $a [PostmanOAuthToken::EXPIRY_TIME] ) ) { + $this->setExpiryTime($a [PostmanOAuthToken::EXPIRY_TIME]); + } + + if ( isset( $a [PostmanOAuthToken::VENDOR_NAME] ) ) { + $this->setVendorName($a [PostmanOAuthToken::VENDOR_NAME]); + } } /** -- cgit v1.2.3