feat: complete jobcard client management foundation
This commit is contained in:
@@ -40,7 +40,7 @@ final class ClientRecord
|
||||
public function normalize(array $record): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->text($record['name'] ?? null) ?? '',
|
||||
'name' => $this->normalizeName($record['name'] ?? null),
|
||||
'registration_number' => $this->text($record['registration_number'] ?? null),
|
||||
'status' => strtolower($this->text($record['status'] ?? null) ?? 'active'),
|
||||
'support_email' => $this->lowerText($record['support_email'] ?? null),
|
||||
@@ -114,6 +114,14 @@ final class ClientRecord
|
||||
return $text === null ? null : strtolower($text);
|
||||
}
|
||||
|
||||
private function normalizeName(mixed $value): ?string
|
||||
{
|
||||
$text = $this->text($value);
|
||||
if ($text === null) return null;
|
||||
$collapsed = preg_replace('/\s+/u', ' ', $text);
|
||||
return $collapsed === false ? $text : $collapsed;
|
||||
}
|
||||
|
||||
private function validPhone(string $phone): bool
|
||||
{
|
||||
if (mb_strlen($phone) > 60 || preg_match('/^[0-9+().\-\s]+$/', $phone) !== 1) {
|
||||
|
||||
Reference in New Issue
Block a user