/** * @return bool|int */ public function getId() { $id = $this->getIdFromSignedCookie(); if (false === $id) { $ipAddress = $this->request->getClientIp(); $geocoderResult = null; if ($this->geocoder) { try { $geocoderResult = $this->geocoder->geocode($ipAddress)->first(); } catch (NoResultException $e) { } } $id = $this->dbGateway->insertUserInformation($ipAddress, $_SERVER['HTTP_USER_AGENT'], php_sapi_name(), $geocoderResult); $this->writeSignedCookie($id); } return $id; }