/** * @return \GeoIp2\Model\City|bool */ public function getCity() { try { $ip = $this->httpRequest->getClientIp(); $city = $this->getReader()->city($ip); } catch (\Exception $e) { $this->logger->critical($e); $city = false; } return $city; }
/** * get user code. * * @param mixed $id * * @return string */ protected function getUserCode($id) { $ipAddress = $this->_phpEnvironmentRequest->getClientIp(true); $cookiefrontend = $this->_cookieManager->getCookie('frontend'); $usercode = $ipAddress . $cookiefrontend . $id; return md5($usercode); }