X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fjcalderonzumba%2Fmink-phantomjs-driver%2Fsrc%2FCookieTrait.php;fp=vendor%2Fjcalderonzumba%2Fmink-phantomjs-driver%2Fsrc%2FCookieTrait.php;h=327b94885d15cead5d1f51e8adc97335e6dbe854;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/jcalderonzumba/mink-phantomjs-driver/src/CookieTrait.php b/vendor/jcalderonzumba/mink-phantomjs-driver/src/CookieTrait.php new file mode 100644 index 000000000..327b94885 --- /dev/null +++ b/vendor/jcalderonzumba/mink-phantomjs-driver/src/CookieTrait.php @@ -0,0 +1,45 @@ +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); + } + } + + /** + * Gets a cookie by its name if exists, else it will return null + * @param string $name + * @return string + */ + public function getCookie($name) { + $cookies = $this->browser->cookies(); + foreach ($cookies as $cookie) { + if ($cookie instanceof Cookie && strcmp($cookie->getName(), $name) === 0) { + return $cookie->getValue(); + } + } + return null; + } + +}