Chris@0: command('cookies'); Chris@0: $objCookies = array(); Chris@0: foreach ($cookies as $cookie) { Chris@0: $objCookies[$cookie["name"]] = new Cookie($cookie); Chris@0: } Chris@0: return $objCookies; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets a cookie on the browser, expires times is set in seconds Chris@0: * @param $cookie Chris@0: * @return mixed Chris@0: */ Chris@0: public function setCookie($cookie) { Chris@0: //TODO: add error control when the cookie array is not valid Chris@0: if (isset($cookie["expires"])) { Chris@0: $cookie["expires"] = intval($cookie["expires"]) * 1000; Chris@0: } Chris@0: $cookie['value'] = urlencode($cookie['value']); Chris@0: return $this->command('set_cookie', $cookie); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Deletes a cookie on the browser if exists Chris@0: * @param $cookieName Chris@0: * @return bool Chris@0: */ Chris@0: public function removeCookie($cookieName) { Chris@0: return $this->command('remove_cookie', $cookieName); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Clear all the cookies Chris@0: * @return bool Chris@0: */ Chris@0: public function clearCookies() { Chris@0: return $this->command('clear_cookies'); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Enables or disables the cookies con phantomjs Chris@0: * @param bool $enabled Chris@0: * @return bool Chris@0: */ Chris@0: public function cookiesEnabled($enabled = true) { Chris@0: return $this->command('cookies_enabled', $enabled); Chris@0: } Chris@0: }