Added more imports

This commit is contained in:
Constantin Graf
2024-03-11 19:12:51 +01:00
parent 77e7a63b83
commit 66a1d8a38b
52 changed files with 1646 additions and 56 deletions

View File

@@ -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;
}
}