diff options
Diffstat (limited to 'main/app/sprinkles/account/src/Util')
-rw-r--r-- | main/app/sprinkles/account/src/Util/HashFailedException.php | 44 | ||||
-rw-r--r-- | main/app/sprinkles/account/src/Util/Util.php | 78 |
2 files changed, 61 insertions, 61 deletions
diff --git a/main/app/sprinkles/account/src/Util/HashFailedException.php b/main/app/sprinkles/account/src/Util/HashFailedException.php index 765096b..580bed1 100644 --- a/main/app/sprinkles/account/src/Util/HashFailedException.php +++ b/main/app/sprinkles/account/src/Util/HashFailedException.php @@ -1,22 +1,22 @@ -<?php -/** - * UserFrosting (http://www.userfrosting.com) - * - * @link https://github.com/userfrosting/UserFrosting - * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License) - */ - -namespace UserFrosting\Sprinkle\Account\Util; - -use UserFrosting\Support\Exception\HttpException; - -/** - * Password hash failure exception. Used when the supplied password could not be hashed for some reason. - * - * @author Alex Weissman (https://alexanderweissman.com) - */ -class HashFailedException extends HttpException -{ - protected $defaultMessage = 'PASSWORD.HASH_FAILED'; - protected $httpErrorCode = 500; -} +<?php
+/**
+ * UserFrosting (http://www.userfrosting.com)
+ *
+ * @link https://github.com/userfrosting/UserFrosting
+ * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
+ */
+
+namespace UserFrosting\Sprinkle\Account\Util;
+
+use UserFrosting\Support\Exception\HttpException;
+
+/**
+ * Password hash failure exception. Used when the supplied password could not be hashed for some reason.
+ *
+ * @author Alex Weissman (https://alexanderweissman.com)
+ */
+class HashFailedException extends HttpException
+{
+ protected $defaultMessage = 'PASSWORD.HASH_FAILED';
+ protected $httpErrorCode = 500;
+}
diff --git a/main/app/sprinkles/account/src/Util/Util.php b/main/app/sprinkles/account/src/Util/Util.php index f8a0444..f3a08a2 100644 --- a/main/app/sprinkles/account/src/Util/Util.php +++ b/main/app/sprinkles/account/src/Util/Util.php @@ -1,39 +1,39 @@ -<?php -/** - * UserFrosting (http://www.userfrosting.com) - * - * @link https://github.com/userfrosting/UserFrosting - * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License) - */ - -namespace UserFrosting\Sprinkle\Account\Util; - -use UserFrosting\Sprinkle\Core\Util\Util as CoreUtil; - -/** - * Util Class - * - * Static utility functions for the account Sprinkle. - * - * @author Alex Weissman (https://alexanderweissman.com) - */ -class Util -{ - /** - * Generate a random, unique username from a list of adjectives and nouns. - */ - static public function randomUniqueUsername($classMapper, $maxLength, $maxTries = 10) { - for ($n = 1; $n <= 3; $n++) { - for ($m = 0; $m < 10; $m++) { - // Generate a random phrase with $n adjectives - $suggestion = CoreUtil::randomPhrase($n, $maxLength, $maxTries, '.'); - if (!$classMapper->staticMethod('user', 'where', 'user_name', $suggestion)->first()) { - return $suggestion; - } - } - } - - return ''; - } - -} +<?php
+/**
+ * UserFrosting (http://www.userfrosting.com)
+ *
+ * @link https://github.com/userfrosting/UserFrosting
+ * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
+ */
+
+namespace UserFrosting\Sprinkle\Account\Util;
+
+use UserFrosting\Sprinkle\Core\Util\Util as CoreUtil;
+
+/**
+ * Util Class
+ *
+ * Static utility functions for the account Sprinkle.
+ *
+ * @author Alex Weissman (https://alexanderweissman.com)
+ */
+class Util
+{
+ /**
+ * Generate a random, unique username from a list of adjectives and nouns.
+ */
+ static public function randomUniqueUsername($classMapper, $maxLength, $maxTries = 10) {
+ for ($n = 1; $n <= 3; $n++) {
+ for ($m = 0; $m < 10; $m++) {
+ // Generate a random phrase with $n adjectives
+ $suggestion = CoreUtil::randomPhrase($n, $maxLength, $maxTries, '.');
+ if (!$classMapper->staticMethod('user', 'where', 'user_name', $suggestion)->first()) {
+ return $suggestion;
+ }
+ }
+ }
+
+ return '';
+ }
+
+}
|