*/
public final function setConfigEntry (string $configKey, $configValue) {
// Is a valid configuration key key provided?
- //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s,configValue[]=%s' . PHP_EOL, __METHOD__, __LINE__, $configKey, gettype($configValue));
+ //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s,configValue[]=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $configKey, gettype($configValue));
if (empty($configKey)) {
// Entry is empty
throw new InvalidArgumentException('Parameter "configKey" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
$configKey = StringUtils::convertDashesToUnderscores($configKey);
// Set the configuration value
- //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s,configValue[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, $configKey, gettype($configValue), $configValue);
+ //* NOISY-DEBUG: */ printf('[%s:%d]: Setting configKey=%s,configValue[%s]=%s - EXIT!' . PHP_EOL, __METHOD__, __LINE__, $configKey, gettype($configValue), $configValue);
self::$configData[$configKey] = $configValue;
}
$classNameParts = explode("\\", $className);
// At least 3 parts should be there
+ //* NOISY-DEBUG: */ printf('[%s:%d]: self::strictNamingConvention=%d,classNameParts()=%d' . PHP_EOL, __METHOD__, __LINE__, intval(self::$strictNamingConvention), count($classNameParts));
if ((self::$strictNamingConvention === true) && (count($classNameParts) < 5)) {
// Namespace scheme is: Tld\Domain\Project\Package[\SubPackage...]
throw new InvalidArgumentException(sprintf('Class name "%s" is not conform to naming-convention: Tld\Domain\Project\Package[\SubPackage...]\SomeFooBar', $className));
* @param $email Email to check for existence
* @return $alreadyTaken Whether the email has been taken
*/
- private function ifEmailIsTaken ($email) {
+ private function ifEmailIsTaken (string $email) {
// Default is already taken
$alreadyTaken = true;
* @param $userName Username to check for existence
* @return $alreadyTaken Whether the username has been taken
*/
- private function ifUserNameIsTaken ($userName) {
+ private function ifUserNameIsTaken (string $userName) {
// Default is already taken
$alreadyTaken = true;
* @param $userName Username to check for existence
* @return $alreadyTaken Whether the username has been taken
*/
- private function ifUserGuestIsTaken ($userName) {
+ private function ifUserGuestIsTaken (string $userName) {
// Default is already taken
$alreadyTaken = true;
* @param $userName Username to check for existence
* @return $alreadyTaken Whether the username has been taken
*/
- private function ifUserNameIsTaken ($userName) {
+ private function ifUserNameIsTaken (string $userName) {
// Default is already taken
$alreadyTaken = true;
use Org\Mxchange\CoreFramework\User\BaseUser;
use Org\Mxchange\CoreFramework\User\UsernameMissingException;
+// Import SPL stuff
+use \InvalidArgumentException;
+
/**
* A generic class for handling guests
*
* @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');
+ }
+
// 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');
+ }
+
// Get a new instance
$userInstance = new Guest();
use Org\Mxchange\CoreFramework\User\BaseUser;
use Org\Mxchange\CoreFramework\User\UsernameMissingException;
+// Import SPL stuff
+use \InvalidArgumentException;
+
/**
* A generic class for handling users
*
* @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();
}
// Prepare output array
- $dataArray = array(
+ $dataArray = [
0 => $className,
1 => $dataStream
- );
+ ];
// Send the infoInstance and dataArray to the output handler
$this->getOutputStreamerInstance()->saveFile($infoInstance, $dataArray);