@@ -70,15 +70,15 @@ Available methods in this library:
7070
7171``` php
7272/**
73- * Default options:
73+ * Cookie options:
7474 *
75- * domain: '' - Domain for which the cookie is available.
76- * expires: 0 - The time the cookie will expire.
77- * httpOnly: false - If cookie will only be available through the HTTP protocol.
78- * path: '/' - Path for which the cookie is available.
79- * raw: false - If cookie will be sent as a raw string.
80- * sameSite: null - Enforces the use of a Lax or Strict SameSite policy.
81- * secure: false - If cookie will only be available through the HTTPS protocol.
75+ * domain: Domain for which the cookie is available.
76+ * expires: The time the cookie will expire.
77+ * httpOnly: If cookie will only be available through the HTTP protocol.
78+ * path: Path for which the cookie is available.
79+ * raw: If cookie will be sent as a raw string.
80+ * sameSite: Enforces the use of a Lax or Strict SameSite policy.
81+ * secure: If cookie will only be available through the HTTPS protocol.
8282 *
8383 * These settings will be used to create and delete cookies.
8484 */
@@ -102,7 +102,11 @@ for supported date and time formats.
102102### Sets a cookie by name
103103
104104``` php
105- $cookie->set(string $name, mixed $value, null|int|string|DateTime $expires = null): void;
105+ $cookie->set(
106+ string $name,
107+ mixed $value,
108+ null|int|string|DateTime $expires = null
109+ ): void
106110```
107111
108112** @throws ** ` CookieException ` if headers already sent.
@@ -114,7 +118,10 @@ $cookie->set(string $name, mixed $value, null|int|string|DateTime $expires = nul
114118If cookies exist they are replaced, if they do not exist they are created.
115119
116120``` php
117- $cookie->replace(array $data, null|int|string|DateTime $expires = null): void
121+ $cookie->replace(
122+ array $data,
123+ null|int|string|DateTime $expires = null
124+ ): void
118125```
119126
120127** @throws ** ` CookieException ` if headers already sent.
@@ -249,19 +256,28 @@ Cookie::set('foo', 'bar', new DateTime('now +1 hour'));
249256Without modifying the expiration time:
250257
251258``` php
252- $cookie->replace(['foo' => 'bar', 'bar' => 'foo']);
259+ $cookie->replace([
260+ 'foo' => 'bar',
261+ 'bar' => 'foo'
262+ ]);
253263```
254264
255265Modifying the expiration time:
256266
257267``` php
258- $cookie->replace(['foo' => 'bar', 'bar' => 'foo'], time() + 3600);
268+ $cookie->replace([
269+ 'foo' => 'bar',
270+ 'bar' => 'foo'
271+ ], time() + 3600);
259272```
260273
261274[ Using the facade] ( #using-the-facade ) :
262275
263276``` php
264- Cookie::replace(['foo' => 'bar', 'bar' => 'foo'], time() + 3600);
277+ Cookie::replace([
278+ 'foo' => 'bar',
279+ 'bar' => 'foo'
280+ ], time() + 3600);
265281```
266282
267283### - Gets a cookie by name
@@ -384,16 +400,13 @@ it will be taken instead of the **expires** value set in the cookie options.
384400 expires: 'now +1 minute'
385401 );
386402
387- $cookie->set('foo', 'bar'); // This cookie will expire in 1 minute
403+ $cookie->set('foo', 'bar'); // Expires in 1 minute
388404
389- $cookie->set('bar', 'foo', 'now +8 days'); // This cookie will expire in 8 days
405+ $cookie->set('bar', 'foo', 'now +8 days'); // Expires in 8 days
390406
391- $cookie->replace(['foo' => 'bar']); // This cookies will expire in 1 minute
407+ $cookie->replace(['foo' => 'bar']); // Expires in 1 minute
392408
393- $cookie->replace( // This cookies will expire in 1 hour
394- ['foo' => 'bar'],
395- time() + 3600
396- );
409+ $cookie->replace(['foo' => 'bar'], time() + 3600); // Expires in 1 hour
397410 ```
398411
399412- If the **expires** parameter passed in the options is a date/time string,
@@ -404,8 +417,7 @@ it is formatted when using the `set` or `replace` method and not when setting th
404417 expires: 'now +1 minute', // It will not be formatted as unix time yet
405418 );
406419
407- $cookie->set('foo', 'bar'); // It is will formatted now
408- // and will expire 1 minute after this cookie is created
420+ $cookie->set('foo', 'bar'); // It is will formatted now and expires in 1 minute
409421 ```
410422
411423## Tests
@@ -456,7 +468,7 @@ composer tests
456468- [ ] Improve tests
457469- [ ] Improve documentation
458470- [ ] Improve English translation in the README file
459- - [ ] Refactor code for disabled code style rules. See [ phpmd.xml] ( phpmd.xml ) and [ phpcs.xml ] ( phpcs.xml )
471+ - [ ] Refactor code for disabled code style rules (see phpmd.xml and phpcs.xml)
460472
461473## Changelog
462474
0 commit comments