Skip to content

Commit

Permalink
Fix hasMissingTokens & update interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannu Pölönen committed Jul 21, 2016
1 parent e08b4fd commit a6d0171
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/classes/NostoAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,14 @@ public function isConnectedToNosto()
public function hasMissingTokens()
{
if (empty($this->tokens)) {
return false;
return true;
}
foreach (NostoApiToken::getApiTokenNames() as $name) {
if ($this->getApiToken($name) === null) {
return false;
return true;
}
}
return true;
return false;
}

/**
Expand Down
10 changes: 9 additions & 1 deletion src/interfaces/account/NostoAccountInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,20 @@ public function delete();
public function getName();

/**
* Checks if this account has been connected to Nosto, i.e. all API tokens exist.
* Checks if this account has been connected to Nosto,
* i.e. all mandatory API tokens exist.
*
* @return bool true if it is connected, false otherwise.
*/
public function isConnectedToNosto();

/**
* Checks if this account has all API tokens
*
* @return bool true if some token(s) are missing, false otherwise.
*/
public function hasMissingTokens();

/**
* Gets an api token associated with this account by it's name , e.g. "sso".
*
Expand Down

0 comments on commit a6d0171

Please sign in to comment.