Nearsoft\SeleniumClient\Options::getCookieNamed PHP Method

getCookieNamed() public method

Gets a cookie by name
public getCookieNamed ( $cookieName ) : Array
return Array
    public function getCookieNamed($cookieName)
    {
        $cookies = $this->getCookies();
        $matches = array_filter($cookies, function ($cookie) use($cookieName) {
            return $cookieName == $cookie->getName();
        });
        if (count($matches) > 1) {
            throw new \Exception("For some reason there are more than 1 cookie named {$cookieName}");
        }
        $matches = array_values($matches);
        return count($matches) > 0 ? $matches[0] : null;
    }