Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -3,11 +3,14 @@
namespace Illuminate\Cookie;
use Illuminate\Support\Arr;
use Illuminate\Support\InteractsWithTime;
use Symfony\Component\HttpFoundation\Cookie;
use Illuminate\Contracts\Cookie\QueueingFactory as JarContract;
class CookieJar implements JarContract
{
use InteractsWithTime;
/**
* The default path (if specified).
*
@@ -20,7 +23,7 @@ class CookieJar implements JarContract
*
* @var string
*/
protected $domain = null;
protected $domain;
/**
* The default secure setting (defaults to false).
@@ -29,48 +32,59 @@ class CookieJar implements JarContract
*/
protected $secure = false;
/**
* The default SameSite option (if specified).
*
* @var string
*/
protected $sameSite;
/**
* All of the cookies queued for sending.
*
* @var array
* @var \Symfony\Component\HttpFoundation\Cookie[]
*/
protected $queued = [];
/**
* Create a new cookie instance.
*
* @param string $name
* @param string $value
* @param int $minutes
* @param string $path
* @param string $domain
* @param bool $secure
* @param bool $httpOnly
* @param string $name
* @param string $value
* @param int $minutes
* @param string $path
* @param string $domain
* @param bool $secure
* @param bool $httpOnly
* @param bool $raw
* @param string|null $sameSite
* @return \Symfony\Component\HttpFoundation\Cookie
*/
public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true)
public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true, $raw = false, $sameSite = null)
{
list($path, $domain, $secure) = $this->getPathAndDomain($path, $domain, $secure);
list($path, $domain, $secure, $sameSite) = $this->getPathAndDomain($path, $domain, $secure, $sameSite);
$time = ($minutes == 0) ? 0 : time() + ($minutes * 60);
$time = ($minutes == 0) ? 0 : $this->availableAt($minutes * 60);
return new Cookie($name, $value, $time, $path, $domain, $secure, $httpOnly);
return new Cookie($name, $value, $time, $path, $domain, $secure, $httpOnly, $raw, $sameSite);
}
/**
* Create a cookie that lasts "forever" (five years).
*
* @param string $name
* @param string $value
* @param string $path
* @param string $domain
* @param bool $secure
* @param bool $httpOnly
* @param string $name
* @param string $value
* @param string $path
* @param string $domain
* @param bool $secure
* @param bool $httpOnly
* @param bool $raw
* @param string|null $sameSite
* @return \Symfony\Component\HttpFoundation\Cookie
*/
public function forever($name, $value, $path = null, $domain = null, $secure = false, $httpOnly = true)
public function forever($name, $value, $path = null, $domain = null, $secure = false, $httpOnly = true, $raw = false, $sameSite = null)
{
return $this->make($name, $value, 2628000, $path, $domain, $secure, $httpOnly);
return $this->make($name, $value, 2628000, $path, $domain, $secure, $httpOnly, $raw, $sameSite);
}
/**
@@ -112,15 +126,15 @@ class CookieJar implements JarContract
/**
* Queue a cookie to send with the next response.
*
* @param mixed
* @param array $parameters
* @return void
*/
public function queue()
public function queue(...$parameters)
{
if (head(func_get_args()) instanceof Cookie) {
$cookie = head(func_get_args());
if (head($parameters) instanceof Cookie) {
$cookie = head($parameters);
} else {
$cookie = call_user_func_array([$this, 'make'], func_get_args());
$cookie = call_user_func_array([$this, 'make'], $parameters);
}
$this->queued[$cookie->getName()] = $cookie;
@@ -143,11 +157,12 @@ class CookieJar implements JarContract
* @param string $path
* @param string $domain
* @param bool $secure
* @param string $sameSite
* @return array
*/
protected function getPathAndDomain($path, $domain, $secure = false)
protected function getPathAndDomain($path, $domain, $secure = false, $sameSite = null)
{
return [$path ?: $this->path, $domain ?: $this->domain, $secure ?: $this->secure];
return [$path ?: $this->path, $domain ?: $this->domain, $secure ?: $this->secure, $sameSite ?: $this->sameSite];
}
/**
@@ -156,11 +171,12 @@ class CookieJar implements JarContract
* @param string $path
* @param string $domain
* @param bool $secure
* @param string $sameSite
* @return $this
*/
public function setDefaultPathAndDomain($path, $domain, $secure = false)
public function setDefaultPathAndDomain($path, $domain, $secure = false, $sameSite = null)
{
list($this->path, $this->domain, $this->secure) = [$path, $domain, $secure];
list($this->path, $this->domain, $this->secure, $this->sameSite) = [$path, $domain, $secure, $sameSite];
return $this;
}
@@ -168,7 +184,7 @@ class CookieJar implements JarContract
/**
* Get the cookies which have been queued for the next request.
*
* @return array
* @return \Symfony\Component\HttpFoundation\Cookie[]
*/
public function getQueuedCookies()
{