From 93477e4e7e9d8ce54167c750734efdbaa2f5a8f1 Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 26 Feb 2017 13:45:00 +0100 Subject: [PATCH] Add shorthands for 'getStatus' in 'Auth' class --- src/Auth.php | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/src/Auth.php b/src/Auth.php index 013009e..5b45bf8 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -1039,6 +1039,78 @@ final class Auth extends UserManager { } } + /** + * Returns whether the currently signed-in user is in "normal" state + * + * @return bool + * + * @see Status + * @see Auth::getStatus + */ + public function isNormal() { + return $this->getStatus() === Status::NORMAL; + } + + /** + * Returns whether the currently signed-in user is in "archived" state + * + * @return bool + * + * @see Status + * @see Auth::getStatus + */ + public function isArchived() { + return $this->getStatus() === Status::ARCHIVED; + } + + /** + * Returns whether the currently signed-in user is in "banned" state + * + * @return bool + * + * @see Status + * @see Auth::getStatus + */ + public function isBanned() { + return $this->getStatus() === Status::BANNED; + } + + /** + * Returns whether the currently signed-in user is in "locked" state + * + * @return bool + * + * @see Status + * @see Auth::getStatus + */ + public function isLocked() { + return $this->getStatus() === Status::LOCKED; + } + + /** + * Returns whether the currently signed-in user is in "pending review" state + * + * @return bool + * + * @see Status + * @see Auth::getStatus + */ + public function isPendingReview() { + return $this->getStatus() === Status::PENDING_REVIEW; + } + + /** + * Returns whether the currently signed-in user is in "suspended" state + * + * @return bool + * + * @see Status + * @see Auth::getStatus + */ + public function isSuspended() { + return $this->getStatus() === Status::SUSPENDED; + } + /** * Sets whether the currently signed-in user has been remembered by a long-lived cookie *