From 85685b77589f1f0e714c821cf7eac3963046c81f Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sun, 18 Nov 2018 15:20:40 +0100 Subject: [PATCH] [Authentication] Throw exception creating objects from this class Callers must use Authentication::showPromptIfNeeded() --- lib/Authentication.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/Authentication.php b/lib/Authentication.php index f9683940..99deaacb 100644 --- a/lib/Authentication.php +++ b/lib/Authentication.php @@ -25,8 +25,6 @@ * @link https://httpd.apache.org/docs/2.4/howto/htaccess.html Apache HTTP Server * Tutorial: .htaccess files * - * @todo This class should respond with an error when creating an object from it. - * See {@see Bridge}, {@see Cache} or {@see Format} for reference. * @todo Configuration parameters should be stored internally instead of accessing * the configuration class directly. * @todo Add functions to detect if a user is authenticated or not. This can be @@ -34,6 +32,16 @@ */ class Authentication { + /** + * Throw an exception when trying to create a new instance of this class. + * Use {@see Authentication::showPromptIfNeeded()} instead! + * + * @throws \LogicException if called. + */ + public function __construct(){ + throw new \LogicException('Use ' . __CLASS__ . '::showPromptIfNeeded()!'); + } + /** * Requests the user for login credentials if necessary. *