namespace Org\Mxchange\CoreFramework\User\Guest;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Manager\Guest\ManageableGuest;
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Request\Requestable;
use Org\Mxchange\CoreFramework\User\BaseUser;
+use Org\Mxchange\CoreFramework\User\UsernameMissingException;
+
+// Import SPL stuff
+use \InvalidArgumentException;
/**
* A generic class for handling guests
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
*
* @return void
*/
- protected function __construct () {
+ private function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
}
* @throws UsernameMissingException If the username does not exist
* @throws UserNoGuestException If the user is no guest account
*/
- public static final function createGuestByUsername ($userName) {
+ public static final function createGuestByUsername (string $userName) {
+ // Check parameter
+ if (empty($userName)) {
+ // Throw IAE
+ throw new InvalidArgumentException('Paramter "userName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+ }
+
// Get a new instance
$userInstance = new Guest();
* @param $email Email address of the user
* @return $userInstance An instance of this user class
*/
- public static final function createGuestByEmail ($email) {
+ public static final function createGuestByEmail (string $email) {
+ // Check parameter
+ if (empty($email)) {
+ // Throw IAE
+ throw new InvalidArgumentException('Paramter "email" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+ }
+
// Get a new instance
$userInstance = new Guest();
/**
* Updates the last activity timestamp and last performed action in the
- * database result. You should call flushPendingUpdates() to flush these updates
- * to the database layer.
+ * database result.
*
* @param $requestInstance A requestable class instance
* @return void
// No activity will be logged for guest accounts
}
- /**
- * Flushs all pending updates to the database layer
- *
- * @return void
- */
- public function flushPendingUpdates () {
- // No updates will be flushed to database!
- }
-
}