diff --git a/src/di.php b/src/di.php index f4792df06..4f7e88f47 100644 --- a/src/di.php +++ b/src/di.php @@ -776,7 +776,7 @@ $di['geoip'] = fn () => new GeoIp2\Database\Reader(PATH_LIBRARY . '/GeoLite2-Cou * * @return \Box_Password */ -$di['password'] = fn () => new \FOSSBilling\PasswordManager(); +$di['password'] = fn () => new FOSSBilling\PasswordManager(); /* * Creates a new Box_Translate object and sets the specified text domain, locale, and other options. diff --git a/src/library/FOSSBilling/PasswordManager.php b/src/library/FOSSBilling/PasswordManager.php index cb4753dd7..18aa2b22f 100644 --- a/src/library/FOSSBilling/PasswordManager.php +++ b/src/library/FOSSBilling/PasswordManager.php @@ -24,18 +24,19 @@ class PasswordManager /** * Sets the password hashing algorithm. - * - * @return object an instance of the current class, for use with chaining. - * - * @throws \Exception if the provided algorithm is not listed as a valid option in PHP. + * + * @return object an instance of the current class, for use with chaining + * + * @throws \Exception if the provided algorithm is not listed as a valid option in PHP */ public function setAlgo(string $algo): object { if (!in_array($algo, password_algos())) { - throw new \Exception("Invalid password hash provided"); + throw new \Exception('Invalid password hash provided'); } $this->algo = $algo; + return $this; } @@ -44,12 +45,13 @@ class PasswordManager return $this->algo; } - /** - * @return object an instance of the current class, for use with chaining + /** + * @return object an instance of the current class, for use with chaining */ public function setOptions($options = []): object { $this->options = array_merge(['cost' => 12], $options); + return $this; } @@ -59,8 +61,8 @@ class PasswordManager } /** - * Creates a hash of the provided password - * + * Creates a hash of the provided password. + * * @throws \Exception if there was an error when hashing the password */ public function hashIt(string $password): string