Skip to content

Commit

Permalink
Zend\Http\Header\SetCookie
Browse files Browse the repository at this point in the history
  - Added an isValidForRequest() method to check for validity within a given context
  • Loading branch information
Ralph Schindler committed Aug 22, 2011
1 parent 062bf02 commit 5c21f81
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion library/Zend/Http/Header/SetCookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,28 @@ public function isSessionCookie()
return ($this->expires === null);
}


public function isValidForRequest($requestUri, $requestDomain, $expiration = null, $isSecure = null)
{
if ($requestUri instanceof \Zend\Uri\Uri) {
$uri = $requestUri->getPath();
}
/* @todo test for path
if ($this->getPath() && (strpos($uri, $this->getPath()) !== 0)) {
return false;
}
*/

/* @todo test for domain
if ($this->getDomain() && (strrpos($requestDomain, $this->getDomain()) !== false)) {
return false;
}
*/

// @todo test expiration
// @todo test isSecure

return true;
}

public function toString()
{
Expand Down

0 comments on commit 5c21f81

Please sign in to comment.