public function getUserFromCookie($cookie)
{
if (($data = $cookie->getValue()) !== '') {
$data = unserialize($data);
if (is_array($data) && count($data) === 2) {
list($username, $token) = $data;
if (isset($this->_users[$username]) && $token === md5($username . $this->_users[$username])) {
return $this->getUser($username);
}
}
}
return null;
}