add tests batch 20
This commit is contained in:
@@ -13,12 +13,10 @@ class UiStyleService
|
||||
$prefs = Preferences::query()->where('user_id', $userId)->first();
|
||||
if ($prefs) {
|
||||
$prefs->fill($updates)->save();
|
||||
|
||||
return $prefs->fresh();
|
||||
}
|
||||
|
||||
$updates['user_id'] = $userId;
|
||||
|
||||
return Preferences::query()->create($updates);
|
||||
}
|
||||
|
||||
@@ -61,7 +59,6 @@ class UiStyleService
|
||||
private function sanitizePaletteKey(?string $value): ?string
|
||||
{
|
||||
$value = trim((string) $value);
|
||||
|
||||
return $value === '' ? null : $value;
|
||||
}
|
||||
|
||||
@@ -71,7 +68,6 @@ class UiStyleService
|
||||
if (in_array($mode, ['light', 'dark', 'auto'], true)) {
|
||||
return $mode;
|
||||
}
|
||||
|
||||
return 'auto';
|
||||
}
|
||||
|
||||
@@ -82,19 +78,17 @@ class UiStyleService
|
||||
return null;
|
||||
}
|
||||
if ($h[0] !== '#') {
|
||||
$h = '#'.$h;
|
||||
$h = '#' . $h;
|
||||
}
|
||||
if (preg_match('/^#([0-9a-fA-F]{3})$/', $h, $m)) {
|
||||
$r = $m[1][0];
|
||||
$g = $m[1][1];
|
||||
$b = $m[1][2];
|
||||
|
||||
return strtoupper('#'.$r.$r.$g.$g.$b.$b);
|
||||
return strtoupper('#' . $r . $r . $g . $g . $b . $b);
|
||||
}
|
||||
if (preg_match('/^#([0-9a-fA-F]{6})$/', $h)) {
|
||||
return strtoupper($h);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user