= 0) { return [ 'class' => 'bg-orange-100 text-orange-700 border-orange-200', 'text' => 'Expiring Soon', 'icon' => 'fa-exclamation-triangle' ]; } return match($status) { 'available' => [ 'class' => 'bg-blue-100 text-blue-700 border-blue-200', 'text' => 'Available', 'icon' => 'fa-info-circle' ], 'active' => [ 'class' => 'bg-green-100 text-green-700 border-green-200', 'text' => 'Active', 'icon' => 'fa-check-circle' ], 'expired' => [ 'class' => 'bg-red-100 text-red-700 border-red-200', 'text' => 'Expired', 'icon' => 'fa-times-circle' ], 'error' => [ 'class' => 'bg-gray-100 text-gray-700 border-gray-200', 'text' => 'Error', 'icon' => 'fa-exclamation-circle' ], default => [ 'class' => 'bg-gray-100 text-gray-700 border-gray-200', 'text' => ucfirst($status), 'icon' => 'fa-question-circle' ] }; } /** * Format multiple domains for display */ public static function formatMultiple(array $domains): array { return array_map([self::class, 'formatForDisplay'], $domains); } /** * Parse and clean WHOIS status array */ public static function parseWhoisStatuses(array $statusArray): array { $validStatuses = []; foreach ($statusArray as $status) { $cleanStatus = trim($status); // Skip if it's just a URL or starts with http/https or // if (empty($cleanStatus) || strpos($cleanStatus, 'http') === 0 || strpos($cleanStatus, '//') === 0 || strpos($cleanStatus, 'www.') === 0) { continue; } $validStatuses[] = $cleanStatus; } return $validStatuses; } /** * Convert status to readable format * Handles camelCase, underscores, etc. */ public static function formatStatusText(string $status): string { // Convert camelCase to readable format (e.g., "clientTransferProhibited" -> "client Transfer Prohibited") $readable = preg_replace('/([a-z])([A-Z])/', '$1 $2', $status); // Convert underscores to spaces and capitalize words $readable = str_replace('_', ' ', $readable); $readable = ucwords(strtolower($readable)); return $readable; } /** * Get active channel count from domain channels */ public static function getActiveChannelCount(array $channels): int { return count(array_filter($channels, fn($ch) => $ch['is_active'])); } }