protected function getUserAgent() { $userAgent = empty($_SERVER['HTTP_USER_AGENT']) ? null : $_SERVER['HTTP_USER_AGENT']; if (!ctype_print($userAgent)) { $userAgent = null; } return $userAgent; }