comparison vendor/symfony/http-foundation/Cookie.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 1fec387a4317
children 129ea1e6d783
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
143 public function __toString() 143 public function __toString()
144 { 144 {
145 $str = ($this->isRaw() ? $this->getName() : urlencode($this->getName())).'='; 145 $str = ($this->isRaw() ? $this->getName() : urlencode($this->getName())).'=';
146 146
147 if ('' === (string) $this->getValue()) { 147 if ('' === (string) $this->getValue()) {
148 $str .= 'deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; max-age=-31536001'; 148 $str .= 'deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; Max-Age=0';
149 } else { 149 } else {
150 $str .= $this->isRaw() ? $this->getValue() : rawurlencode($this->getValue()); 150 $str .= $this->isRaw() ? $this->getValue() : rawurlencode($this->getValue());
151 151
152 if (0 !== $this->getExpiresTime()) { 152 if (0 !== $this->getExpiresTime()) {
153 $str .= '; expires='.gmdate('D, d-M-Y H:i:s T', $this->getExpiresTime()).'; max-age='.$this->getMaxAge(); 153 $str .= '; expires='.gmdate('D, d-M-Y H:i:s T', $this->getExpiresTime()).'; Max-Age='.$this->getMaxAge();
154 } 154 }
155 } 155 }
156 156
157 if ($this->getPath()) { 157 if ($this->getPath()) {
158 $str .= '; path='.$this->getPath(); 158 $str .= '; path='.$this->getPath();
222 * 222 *
223 * @return int 223 * @return int
224 */ 224 */
225 public function getMaxAge() 225 public function getMaxAge()
226 { 226 {
227 return 0 !== $this->expire ? $this->expire - time() : 0; 227 $maxAge = $this->expire - time();
228
229 return 0 >= $maxAge ? 0 : $maxAge;
228 } 230 }
229 231
230 /** 232 /**
231 * Gets the path on the server in which the cookie will be available on. 233 * Gets the path on the server in which the cookie will be available on.
232 * 234 *