For more details and usage information on CookieCollection, see the guide article on handling cookies.
Since: 2.0
Author: Qiang Xue (qiang.xue@gmail.com)
Inheritance: extends yii\base\Object, implements IteratorAggregate, implements ArrayAccess, implements Countable
Example #1
0
 /**
  * @inheritdoc
  */
 public function bootstrap($app)
 {
     //echo preg_replace('/ \((?!(The|UCSD)\)).*?\)/', '', 'The makanan UCSD');exit;
     if ($app instanceof \yii\web\Application) {
         $activeTheme = $this->defaultTheme;
         if ($this->useDbConfig) {
         } else {
             $cookie = new CookieCollection();
             if ($themeNameFromCookie = $cookie->get($this->themeCookieName)) {
                 $activeTheme = $themeNameFromCookie;
             }
         }
         if (!$activeTheme) {
             $activeTheme = $this->getTheme($app);
         }
     }
 }
 /**
  * Returns the cookie collection.
  * The cookie collection contains the cookies associated with HTTP message.
  * @return CookieCollection|Cookie[] the cookie collection.
  */
 public function getCookies()
 {
     if (!is_object($this->_cookies)) {
         $cookieCollection = new CookieCollection();
         if (is_array($this->_cookies)) {
             foreach ($this->_cookies as $cookie) {
                 if (!is_object($cookie)) {
                     $cookie = new Cookie($cookie);
                 }
                 $cookieCollection->add($cookie);
             }
         }
         $this->_cookies = $cookieCollection;
     }
     return $this->_cookies;
 }