|  | 
|  | 1 | +<?php | 
|  | 2 | + | 
|  | 3 | +namespace Symfony\Component\HttpFoundation; | 
|  | 4 | + | 
|  | 5 | +class Cookie | 
|  | 6 | +{ | 
|  | 7 | +    public const SAMESITE_NONE = 'none'; | 
|  | 8 | +    public const SAMESITE_LAX = 'lax'; | 
|  | 9 | +    public const SAMESITE_STRICT = 'strict'; | 
|  | 10 | + | 
|  | 11 | +    /** | 
|  | 12 | +     * @param string                        $name     The name of the cookie | 
|  | 13 | +     * @param string|null                   $value    The value of the cookie | 
|  | 14 | +     * @param int|string|\DateTimeInterface $expire   The time the cookie expires | 
|  | 15 | +     * @param string                        $path     The path on the server in which the cookie will be available on | 
|  | 16 | +     * @param string|null                   $domain   The domain that the cookie is available to | 
|  | 17 | +     * @param bool|null                     $secure   Whether the client should send back the cookie only over HTTPS or null to auto-enable this when the request is already using HTTPS | 
|  | 18 | +     * @param bool                          $httpOnly Whether the cookie will be made accessible only through the HTTP protocol | 
|  | 19 | +     * @param bool                          $raw      Whether the cookie value should be sent with no url encoding | 
|  | 20 | +     * @param self::SAMESITE_*|''|null      $sameSite Whether the cookie will be available for cross-site requests | 
|  | 21 | +     * | 
|  | 22 | +     * @throws \InvalidArgumentException | 
|  | 23 | +     */ | 
|  | 24 | +    public function __construct(string $name, string $value = null, $expire = 0, ?string $path = '/', string $domain = null, ?bool $secure = false, bool $httpOnly = true, bool $raw = false, string $sameSite = null); | 
|  | 25 | + | 
|  | 26 | +    /** | 
|  | 27 | +     * @param string                        $name     The name of the cookie | 
|  | 28 | +     * @param string|null                   $value    The value of the cookie | 
|  | 29 | +     * @param int|string|\DateTimeInterface $expire   The time the cookie expires | 
|  | 30 | +     * @param string                        $path     The path on the server in which the cookie will be available on | 
|  | 31 | +     * @param string|null                   $domain   The domain that the cookie is available to | 
|  | 32 | +     * @param bool|null                     $secure   Whether the client should send back the cookie only over HTTPS or null to auto-enable this when the request is already using HTTPS | 
|  | 33 | +     * @param bool                          $httpOnly Whether the cookie will be made accessible only through the HTTP protocol | 
|  | 34 | +     * @param bool                          $raw      Whether the cookie value should be sent with no url encoding | 
|  | 35 | +     * @param self::SAMESITE_*|''|null      $sameSite Whether the cookie will be available for cross-site requests | 
|  | 36 | +     * | 
|  | 37 | +     * @throws \InvalidArgumentException | 
|  | 38 | +     */ | 
|  | 39 | +    public function create(string $name, string $value = null, $expire = 0, ?string $path = '/', string $domain = null, ?bool $secure = false, bool $httpOnly = true, bool $raw = false, string $sameSite = null): self; | 
|  | 40 | + | 
|  | 41 | +    /** | 
|  | 42 | +     * @return self::SAMESITE_*|null | 
|  | 43 | +     */ | 
|  | 44 | +    public function getSameSite(); | 
|  | 45 | + | 
|  | 46 | +    /** | 
|  | 47 | +     * @param self::SAMESITE_*|''|null $sameSite | 
|  | 48 | +     */ | 
|  | 49 | +    public function withSameSite(?string $sameSite): self; | 
|  | 50 | +} | 
0 commit comments