mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-12 18:22:16 +01:00
Added more imports
This commit is contained in:
@@ -31,8 +31,15 @@ class ColorService
|
||||
'#78909c',
|
||||
];
|
||||
|
||||
private const string VALID_REGEX = '/^#[0-9a-f]{6}$/';
|
||||
|
||||
public function getRandomColor(): string
|
||||
{
|
||||
return self::COLORS[array_rand(self::COLORS)];
|
||||
}
|
||||
|
||||
public function isValid(string $color): bool
|
||||
{
|
||||
return preg_match(self::VALID_REGEX, $color) === 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user