public function CookieTrait::setCookie in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/jcalderonzumba/mink-phantomjs-driver/src/CookieTrait.php \Zumba\Mink\Driver\CookieTrait::setCookie()
Sets a cookie on the browser, if null value then delete it
Parameters
string $name:
string $value:
File
- vendor/
jcalderonzumba/ mink-phantomjs-driver/ src/ CookieTrait.php, line 18
Class
- CookieTrait
- Trait CookieTrait @package Zumba\Mink\Driver
Namespace
Zumba\Mink\DriverCode
public function setCookie($name, $value = null) {
if ($value === null) {
$this->browser
->removeCookie($name);
}
//TODO: set the cookie with domain, not with url, meaning www.aaa.com or .aaa.com
if ($value !== null) {
$urlData = parse_url($this
->getCurrentUrl());
$cookie = array(
"name" => $name,
"value" => $value,
"domain" => $urlData["host"],
);
$this->browser
->setCookie($cookie);
}
}