Remove unnecessary parameters

This commit is contained in:
Franz Liedke 2016-12-28 22:51:03 +01:00
parent 27b9c169fa
commit 4c66759c40

View File

@ -35,29 +35,21 @@ class CookieFactory
* @param string $name * @param string $name
* @param string $value * @param string $value
* @param int $maxAge * @param int $maxAge
* @param string $path
* @param bool $secure
* @param bool $httpOnly
* @param string $domain
* @return \Dflydev\FigCookies\SetCookie * @return \Dflydev\FigCookies\SetCookie
*/ */
public function make($name, $value = null, $maxAge = null, $path = null, $secure = null, $httpOnly = true, $domain = null) public function make($name, $value = null, $maxAge = null)
{ {
$url = parse_url(rtrim($this->app->url(), '/')); $url = parse_url(rtrim($this->app->url(), '/'));
if ($path === null) { $path = array_get($url, 'path') ?: '/';
$path = array_get($url, 'path') ?: '/';
}
if ($secure === null && array_get($url, 'scheme') === 'https') { $secure = array_get($url, 'scheme') === 'https';
$secure = true;
}
return SetCookie::create($name, $value) return SetCookie::create($name, $value)
->withMaxAge($maxAge) ->withMaxAge($maxAge)
->withPath($path) ->withPath($path)
->withSecure($secure) ->withSecure($secure)
->withHttpOnly($httpOnly) ->withHttpOnly(true)
->withDomain($domain); ->withDomain(null);
} }
} }