From 86dfbfcfefc11520749fc955bb1ab5b5d939f44c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 5 Apr 2016 17:00:29 +0200 Subject: [PATCH] Documented the arguments of the Cookie class --- components/http_foundation/introduction.rst | 40 ++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 6f6c6ccc5eb..b5d3cb7fb24 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -377,7 +377,45 @@ attribute:: The :method:`Symfony\\Component\\HttpFoundation\\ResponseHeaderBag::setCookie` method takes an instance of -:class:`Symfony\\Component\\HttpFoundation\\Cookie` as an argument. +:class:`Symfony\\Component\\HttpFoundation\\Cookie` as an argument. This class +takes eight arguments in its constructor: + +``$name`` + **type**: ``string`` **default**: none (this argument is mandatory) + The name of the cookie. +``$value`` + **type**: ``string`` **default**: ``null`` + The value stored in the cookie. +``$expire`` + **type**: ``int``|``string``|``DateTime``|``DateTimeInterface`` **default**: 0 + The time the cookie expires. This value can be set as a timestamp integer, + as a ``strtotime()`` valid date string (e.g. ``+1 week``), as a ``DateTime`` + object or as an object which implements ``DateTimeInterface``. + The default value is ``0``, which deletes the cookie as soon as the browser + is closed. +``$path`` + **type**: ``string`` **default**: ``/`` + The path on the server in which the cookie will be available on. The default + values makes the cookie available on any URL of the server. +``$domain`` + **type**: ``string`` **default**: ``null`` + The domain that the cookie is available to. The default value makes the cookie + available just for the current domain (and any of its subdomains). +``$secure`` + **type**: ``bool`` **default**: ``false`` + Whether the cookie should only be transmitted over a secure HTTPS connection + from the client. +``$httpOnly`` + **type**: ``bool`` **default**: ``true`` + Whether the cookie will be made accessible only through the HTTP protocol. +``$raw`` + .. versionadded:: 3.1 + The ``$raw`` argument was introduced in Symfony 3.1. + + **type**: ``bool`` **default**: ``false`` + Whether the cookie value should be sent with no URL encoding. If set to + ``true`` the cookie is created with the ``setrawcookie()`` PHP function + instead of ``setcookie()``. You can clear a cookie via the :method:`Symfony\\Component\\HttpFoundation\\ResponseHeaderBag::clearCookie` method. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy