1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-08-05 15:47:25 +02:00

Improve code style

This commit is contained in:
Marco
2017-10-20 08:53:02 +02:00
parent 2cf7b27ba3
commit f1360dceba

View File

@@ -446,20 +446,14 @@ final class Auth extends UserManager {
$content = '';
}
// set the cookie with the selector and token
// save the cookie with the selector and token (requests a cookie to be written on the client)
$cookie = new Cookie($this->rememberCookieName);
$cookie->setValue($content);
$cookie->setExpiryTime($expires);
$cookie->setPath($params['path']);
$cookie->setDomain($params['domain']);
$cookie->setHttpOnly($params['httponly']);
$cookie->setSecureOnly($params['secure']);
// save the instance (requests a cookie to be written on the client)
$result = $cookie->save();
if ($result === false) {
@@ -468,19 +462,12 @@ final class Auth extends UserManager {
// if we've been deleting the cookie above
if (!isset($selector) || !isset($token)) {
// attempt to delete a potential old cookie from versions v1.x.x to v6.x.x as well
// attempt to delete a potential old cookie from versions v1.x.x to v6.x.x as well (requests a cookie to be written on the client)
$cookie = new Cookie('auth_remember');
if (!empty($params['path'])) {
$cookie->setPath($params['path']);
}
$cookie->setPath((!empty($params['path'])) ? $params['path'] : '/');
$cookie->setDomain($params['domain']);
$cookie->setHttpOnly($params['httponly']);
$cookie->setSecureOnly($params['secure']);
// delete the instance (requests a cookie to be written on the client)
$cookie->delete();
}
}
@@ -540,16 +527,12 @@ final class Auth extends UserManager {
// get our cookie settings
$params = $this->createCookieSettings();
// cause the session cookie to be deleted
// ask for the session cookie to be deleted (requests a cookie to be written on the client)
$cookie = new Cookie(\session_name());
$cookie->setPath($params['path']);
$cookie->setDomain($params['domain']);
$cookie->setHttpOnly($params['httponly']);
$cookie->setSecureOnly($params['secure']);
// delete the instance (requests a cookie to be written on the client)
$result = $cookie->delete();
if ($result === false) {