From 22e5e43e117c06741999670b43037ddb66689110 Mon Sep 17 00:00:00 2001 From: Iliain Date: Wed, 16 Oct 2024 11:08:09 +1100 Subject: [PATCH] FIX: trim construct function --- src/UsernameRandomizer.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/UsernameRandomizer.php b/src/UsernameRandomizer.php index 5036192..aac8762 100644 --- a/src/UsernameRandomizer.php +++ b/src/UsernameRandomizer.php @@ -26,19 +26,11 @@ class UsernameRandomizer */ public function __construct($customAdjectives = null, $customNouns = null) { + // $adjectiveArray and $nounArray are defined in RandomizerArrays.php include __DIR__ . '/RandomizerArrays.php'; - if ($customAdjectives === null) { - self::$adjectiveList = $adjectiveArray; - } else { - self::$adjectiveList = $customAdjectives; - } - - if ($customNouns === null) { - self::$nounList = $nounArray; - } else { - self::$nounList = $customNouns; - } + self::$adjectiveList = $customAdjectives ?? $adjectiveArray; + self::$nounList = $customNouns ?? $nounArray; } /** @@ -145,7 +137,7 @@ public static function getFormattedWord($word, $options): string /** * Toggles the case of each letter in the provided word. E.g. "hello" becomes "HeLlO" - * @param $word string + * @param string $word */ public static function getToggleCaseWord($word): string {