@@ -23,7 +23,7 @@ |
||
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | 25 | private const ALLOWED_OPTIONS = [ |
| 26 | - // 'expires', |
|
| 26 | + // 'expires', |
|
| 27 | 27 | 'path', |
| 28 | 28 | 'domain', |
| 29 | 29 | 'secure', |
@@ -33,27 +33,27 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | private function setExpires($ttl): void |
| 35 | 35 | { |
| 36 | - if($ttl instanceof \DateTimeInterface){ |
|
| 36 | + if ($ttl instanceof \DateTimeInterface) { |
|
| 37 | 37 | $this->expires = $ttl->getTimestamp(); |
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | //Срок действия cookie истечет с окончанием сессии (при закрытии браузера). |
| 42 | 42 | if ($ttl === 0 || $ttl === true || strtolower((string)$ttl) === 'session') { |
| 43 | - $this->expires = 0; |
|
| 43 | + $this->expires = 0; |
|
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // Если число то прибавляем значение к метке времени timestamp |
| 48 | 48 | // Для установки сессионной куки надо использовать FALSE |
| 49 | 49 | if (is_numeric($ttl)) { |
| 50 | - $this->expires = $this->currentTimestamp + (int)$ttl; |
|
| 50 | + $this->expires = $this->currentTimestamp + (int)$ttl; |
|
| 51 | 51 | return; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | if (is_string($ttl)) { |
| 55 | 55 | if (false !== $returnTtl = strtotime($ttl, $this->currentTimestamp)) { |
| 56 | - $this->expires = $returnTtl; |
|
| 56 | + $this->expires = $returnTtl; |
|
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | throw new Exception(sprintf('strtotime() failed to convert string "%s" to timestamp', $ttl)); |