public function OAuthKey::exists in Lightning API 8.3
Same name and namespace in other branches
- 8.4 src/OAuthKey.php \Drupal\lightning_api\OAuthKey::exists()
- 8 src/OAuthKey.php \Drupal\lightning_api\OAuthKey::exists()
- 8.2 src/OAuthKey.php \Drupal\lightning_api\OAuthKey::exists()
Checks if one or both OAuth key components exist.
Parameters
string $which: (optional) Which key component to check. Can be 'public' or 'private'. If omitted, both components are checked.
Return value
bool TRUE if the key component(s) exist, FALSE otherwise.
File
- src/
OAuthKey.php, line 60
Class
- OAuthKey
- Generates key pairs for use with OAuth.
Namespace
Drupal\lightning_apiCode
public function exists($which = NULL) {
if ($which) {
$key = $this->configFactory
->get('simple_oauth.settings')
->get("{$which}_key");
return $key && file_exists($key) && (fileperms($key) & 0777) === static::PERMISSIONS;
}
else {
return $this
->exists('private') && $this
->exists('public');
}
}