From f1360dcebac4ea8fd0b314188d18a81cfc7807b1 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 20 Oct 2017 08:53:02 +0200 Subject: [PATCH] Improve code style --- src/Auth.php | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/Auth.php b/src/Auth.php index 97b9751..9f766c4 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -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) {