customers->retrieve($customerId); $name = is_string($customer->name) ? trim($customer->name) : ''; $email = is_string($customer->email) ? trim($customer->email) : ''; return match (true) { $name !== '' && $email !== '' => "{$name} ({$email})", $email !== '' => $email, $name !== '' => $name, default => $customerId, }; } catch (Throwable) { return $customerId; } } }