Apply PHP Code Styling & Quality Changes (#2195)

Co-authored-by: FOSSBilling Bot <fossbilling-bot>
This commit is contained in:
FOSSBilling BotandFOSSBilling Bot authored and GitHub committed 2024-03-21 05:51:58 -07:00
1 parent 628726e61a
commit f9e9265043
2 files changed
+12 -10

No files matched your search

+1 -1
View File
@@ -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.
+11 -9
View File
@@ -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