From 2d78e5d7f36930875202e498ffd53673ee2563c4 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 25 Sep 2018 09:10:51 -0500 Subject: [PATCH] formatting --- .../Http/Middleware/VerifyCsrfToken.php | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php b/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php index b97740bb03f1..2c21bcfb7464 100644 --- a/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php +++ b/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php @@ -73,7 +73,7 @@ public function handle($request, Closure $next) $this->tokensMatch($request) ) { return tap($next($request), function ($response) use ($request) { - if ($this->shouldAddHttpCookie()) { + if ($this->shouldAddXsrfTokenCookie()) { $this->addCookieToResponse($request, $response); } }); @@ -156,6 +156,16 @@ protected function getTokenFromRequest($request) return $token; } + /** + * Determine if the cookie should be added to the response. + * + * @return bool + */ + public function shouldAddXsrfTokenCookie() + { + return $this->addHttpCookie; + } + /** * Add the CSRF token to the response cookies. * @@ -186,19 +196,4 @@ public static function serialized() { return EncryptCookies::serialized('XSRF-TOKEN'); } - - /* - * Get the decision to add the Http cookie to the request.. - * - * @return bool - */ - - public function shouldAddHttpCookie() - { - if (method_exists($this, 'addHttpCookie')) { - return $this->addHttpCookie(); - } - - return property_exists($this, 'addHttpCookie') ? $this->addHttpCookie : true; - } }