From 019cf6ccddcab691f381c8d4323bcedb7cefe54f Mon Sep 17 00:00:00 2001 From: Dejan Savuljesku Date: Thu, 22 Aug 2019 09:37:46 +0200 Subject: [PATCH] Add method to clear all keys associated with the user This is needed when changing modules, we need to remove all keys from the old module Change-Id: Iaada3df631260dbd612cce01f5477e93e6da4596 --- src/OATHUser.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/OATHUser.php b/src/OATHUser.php index be632017..26eb9caa 100644 --- a/src/OATHUser.php +++ b/src/OATHUser.php @@ -110,6 +110,20 @@ class OATHUser { } } + /** + * Removes all keys associated with the user + * Warning: This only removes the keys in memory, + * changes need to be persisted + */ + public function clearAllKeys() { + $this->keys = []; + } + + /** + * Adds single key to the key array + * + * @param IAuthKey $key + */ public function addKey( IAuthKey $key ) { if ( !$this->keyTypeCorrect( $key ) ) { return;