You are here

public function Account::testConnection in GatherContent 8.3

Same name and namespace in other branches
  1. 8 src/DAO/Account.php \Drupal\gathercontent\DAO\Account::testConnection()

Test connection with current credentials.

Return value

bool Return TRUE on success connection otherwise FALSE.

File

src/DAO/Account.php, line 91

Class

Account
Class Account.

Namespace

Drupal\gathercontent\DAO

Code

public function testConnection() {
  try {
    $response = $this->client
      ->get('/me');
    if ($response
      ->getStatusCode() === 200) {
      return TRUE;
    }
    else {
      return FALSE;
    }
  } catch (\Exception $e) {
    return FALSE;
  }
}