get_meta_name( $type ) ); if ( is_array( $tokenArray ) ) { return new Token( $type, $tokenArray[ self::ACCESS_TOKEN_KEY ], $tokenArray[ self::INTEGRATION_ID_KEY ] ); } throw new TokenNotFoundException; } /** * @inheritDoc */ public function storeToken( Token $token ) { update_option( $this->get_meta_name( $token->getType() ), array( self::ACCESS_TOKEN_KEY => $token->getAccessToken(), self::INTEGRATION_ID_KEY => $token->getIntegrationId(), ) ); } /** * @return int * * @throws TokenNotFoundException */ public function get_integration_id() { $token = $this->retrieveToken( TokenType::WORDPRESS ); return $token->getIntegrationId(); } /** * @param string $type * * @return string */ private function get_meta_name( $type ) { return self::TWOFAS_OAUTH_TOKEN_BASE . $type; } }