Neos\Flow\Http\Cookie::__construct PHP Метод

__construct() публичный Метод

Constructs a new Cookie object
public __construct ( string $name, mixed $value = null, integer | DateTime $expires, integer $maximumAge = null, string $domain = null, string $path = '/', boolean $secure = false, boolean $httpOnly = true )
$name string The cookie name as a valid token (RFC 2616)
$value mixed The value to store in the cookie. Must be possible to cast into a string.
$expires integer | DateTime Date and time after which this cookie expires.
$maximumAge integer Number of seconds until the cookie expires.
$domain string The host to which the user agent will send this cookie
$path string The path describing the scope of this cookie
$secure boolean If this cookie should only be sent through a "secure" channel by the user agent
$httpOnly boolean If this cookie should only be used through the HTTP protocol
    public function __construct($name, $value = null, $expires = 0, $maximumAge = null, $domain = null, $path = '/', $secure = false, $httpOnly = true)
    {
        if (preg_match(self::PATTERN_TOKEN, $name) !== 1) {
            throw new \InvalidArgumentException('The parameter "name" passed to the Cookie constructor must be a valid token as per RFC 2616, Section 2.2.', 1345101977);
        }
        if ($expires instanceof \Datetime) {
            $expires = $expires->getTimestamp();
        }
        if (!is_integer($expires)) {
            throw new \InvalidArgumentException('The parameter "expires" passed to the Cookie constructor must be a unix timestamp or a DateTime object.', 1345108785);
        }
        if ($maximumAge !== null && !is_integer($maximumAge)) {
            throw new \InvalidArgumentException('The parameter "maximumAge" passed to the Cookie constructor must be an integer value.', 1345108786);
        }
        if ($domain !== null && preg_match(self::PATTERN_DOMAIN, $domain) !== 1) {
            throw new \InvalidArgumentException('The parameter "domain" passed to the Cookie constructor must be a valid domain as per RFC 6265, Section 4.1.2.3.', 1345116246);
        }
        if ($path !== null && preg_match(self::PATTERN_PATH, $path) !== 1) {
            throw new \InvalidArgumentException('The parameter "path" passed to the Cookie constructor must be a valid path as per RFC 6265, Section 4.1.1.', 1345123078);
        }
        $this->name = $name;
        $this->value = $value;
        $this->expiresTimestamp = $expires;
        $this->maximumAge = $maximumAge;
        $this->domain = $domain;
        $this->path = $path;
        $this->secure = $secure == true;
        $this->httpOnly = $httpOnly == true;
    }