This commit is contained in:
@@ -127,6 +127,22 @@ final class Avatar
|
||||
return $presets;
|
||||
}
|
||||
|
||||
public static function presetGroupForPreset(string $preset): string
|
||||
{
|
||||
$preset = preg_replace('/[^a-z0-9_]/', '', strtolower($preset)) ?: '';
|
||||
if (preg_match('/modern_(\d{3})/', $preset, $matches)) {
|
||||
$number = (int)$matches[1];
|
||||
foreach (self::presetGroups() as $groupKey => $group) {
|
||||
[$start, $end] = $group['range'];
|
||||
if ($number >= $start && $number <= $end) {
|
||||
return $groupKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 'fair';
|
||||
}
|
||||
|
||||
public static function selectColumns(string $alias = 'p'): string
|
||||
{
|
||||
$columns = array_keys(self::defaults());
|
||||
|
||||
Reference in New Issue
Block a user