/** * Gets the cookie or jar * @param string|null $key * @return \Nimbles\Http\Cookie|\Nimbles\Http\Cookie\Jar|null */ public function getCookie($key = null) { if (null === $this->_cookie) { $this->setCookie(); } if (null === $key) { return $this->_cookie; } if ($this->_cookie->offsetExists($key)) { return $this->_cookie[$key]; } return null; }
/** * Gets a cookie variable by key * @param string|null $key * @return \Nimbles\Http\Cookie\Jar|string|null */ public function getCookie($key = null) { if (null === $this->_cookie) { $this->_cookie = new Cookie\Jar($this->getCookieRaw(), array('readonly' => true)); } if (null === $key) { return $this->_cookie; } return $this->_cookie->offsetExists($key) ? $this->_cookie[$key] : null; }