/**
  * @param Account $account
  */
 protected function assertAccount(Account $account)
 {
     $this->assertEquals($this->accountId, $account->getAccountId());
     $this->assertEquals($this->accountName, $account->getAccountName());
     $this->assertEquals($this->googleId, $account->getGoogleId());
     $this->assertEquals($this->googleName, $account->getGoogleName());
     $this->assertEquals($this->email, $account->getEmail());
     $this->assertEquals($this->accessToken, $account->getAccessToken());
     $this->assertEquals($this->refreshToken, $account->getRefreshToken());
 }
 public function addSheet(Account $account, $params)
 {
     $exists = false;
     foreach ($account->getSheets() as $sheet) {
         /** @var Sheet $sheet */
         if ($sheet->getGoogleId() == $params['googleId'] && $sheet->getSheetId() == $params['sheetId']) {
             $exists = true;
             break;
         }
     }
     if (!$exists) {
         $account->addSheet(new Sheet($params));
     }
 }
 /**
  * @param Account $account
  * @return RestApi
  */
 protected function getApi(Account $account)
 {
     /** @var RestApi $googleDriveApi */
     $googleDriveApi = $this->container->get('ex_google_drive.rest_api');
     $googleDriveApi->getApi()->setCredentials($account->getAccessToken(), $account->getRefreshToken());
     $this->extractor = $this->container->get('ex_google_drive.extractor');
     $this->extractor->setConfiguration($this->getConfiguration());
     $this->extractor->setCurrAccountId($account->getAccountId());
     $googleDriveApi->getApi()->setRefreshTokenCallback([$this->extractor, 'refreshTokenCallback']);
     return $googleDriveApi;
 }