// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
use Org\Mxchange\CoreFramework\Manager\Login\ManageableMember;
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\User\BaseUser;
use Org\Mxchange\CoreFramework\User\UsernameMissingException;
+// Import SPL stuff
+use \InvalidArgumentException;
+
/**
* A generic class for handling users
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2022 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 UnexpectedGuestAccountException If the user status is 'guest'
*/
- public static final function createMemberByUsername ($userName) {
+ public static final function createMemberByUsername (string $userName) {
+ // Check parameter
+ if (empty($userName)) {
+ // Throw IAE
+ throw new InvalidArgumentException('Parameter "userName" is empty');
+ }
+
// Get a new instance
$userInstance = new Member();
* @param $email Email address of the user
* @return $userInstance An instance of this user class
*/
- public static final function createMemberByEmail ($email) {
+ public static final function createMemberByEmail (string $email) {
+ // Check parameter
+ if (empty($email)) {
+ // Throw IAE
+ throw new InvalidArgumentException('Parameter "email" is empty');
+ }
+
// Get a new instance
$userInstance = new Member();
// If there is no action use the default on
if (is_null($lastAction)) {
$lastAction = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('login_default_action');
- } // END - if
+ }
// Get a critieria instance
$searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
// Add search criteria
- $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
+ $searchInstance->addCriteria(UserDatabaseFrontend::DB_COLUMN_USERNAME, $this->getUserName());
$searchInstance->setLimit(1);
// Now get another criteria
// Add the search criteria for searching for the right entry
$updateInstance->setSearchInstance($searchInstance);
- // Set wrapper class name
- $updateInstance->setWrapperConfigEntry('user_db_wrapper_class');
+ // Set frontend class name
+ $updateInstance->setFrontendConfigEntry('user_db_frontend_class');
// Remember the update in database result
$this->getResultInstance()->add2UpdateQueue($updateInstance);