Symfony\Component\BrowserKit\Cookie::isExpired PHP Method

isExpired() public method

Returns true if the cookie has expired.
public isExpired ( ) : boolean
return boolean true if the cookie has expired, false otherwise
    public function isExpired()
    {
        return null !== $this->expires && 0 !== $this->expires && $this->expires < time();
    }

Usage Example

Example #1
3
 public function testIsExpired()
 {
     $cookie = new Cookie('foo', 'bar');
     $this->assertFalse($cookie->isExpired(), '->isExpired() returns false when the cookie never expires (null as expires time)');
     $cookie = new Cookie('foo', 'bar', time() - 86400);
     $this->assertTrue($cookie->isExpired(), '->isExpired() returns true when the cookie is expired');
     $cookie = new Cookie('foo', 'bar', 0);
     $this->assertFalse($cookie->isExpired());
 }