Prado\Web\THttpCookieCollection::findCookieByName PHP Method

findCookieByName() public method

Finds the cookie with the specified name.
public findCookieByName ( $name ) : THttpCookie
return THttpCookie the cookie, null if not found
    public function findCookieByName($name)
    {
        foreach ($this as $cookie) {
            if ($cookie->getName() === $name) {
                return $cookie;
            }
        }
        return null;
    }

Usage Example

 public function testFindCookieByName()
 {
     $coll = new THttpCookieCollection();
     $coll->insertAt(0, new THttpCookie('name', 'value'));
     self::assertEquals('value', $coll->findCookieByName('name')->getValue());
     self::assertNull($coll->findCookieByName('invalid'));
 }