refactor: code style changes

Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
2023-01-15 00:04:00 +00:00
parent 25155bff2e
commit 3727c84f3e
146 changed files with 1013 additions and 1341 deletions

View File

@@ -33,30 +33,28 @@ use Illuminate\Support\Facades\Log;
*/
class Options
{
/**
* Returns an assortment of settings found in the mentioned category
*
* @param string $category The category
* @param string $category The category
* @return Collection The settings in this category
*
* @throws EmptyOptionsException
*/
public function getCategory(string $category): Collection
{
$options = Option::where('option_category', $category)->get();
if ($options->isEmpty())
{
throw new EmptyOptionsException('There are no options in category ' . $category);
if ($options->isEmpty()) {
throw new EmptyOptionsException('There are no options in category '.$category);
}
return $options;
}
public function getOption(string $option): string
{
$value = Cache::get($option);
if (is_null($value)) {
Log::debug('Option '.$option.'not found in cache, refreshing from database');
$value = Option::where('option_name', $option)->first();
@@ -79,7 +77,7 @@ class Options
'option_name' => $option,
'option_value' => $value,
'friendly_name' => $description,
'option_category' => $category
'option_category' => $category,
]);
Cache::put($option, $value, now()->addDay());
@@ -115,9 +113,9 @@ class Options
$dbOptionInstance->save();
Log::debug('New db configuration option saved',
[
'option' => $dbOptionInstance->option_value,
]);
[
'option' => $dbOptionInstance->option_value,
]);
Cache::put('option_name', $newValue, now()->addDay());
} else {