public function __construct(CookieInterface $cookie, &$target_array = null) { $name = $cookie->getName(); $value = $cookie->getValue(); $expire = $cookie->getExpiration(); $expire = $expire ? $expire->getTimestamp() : null; // Populate current superglobals (or overriden one) if (is_array($target_array)) { $target_array[$name] = $value; } else { $_COOKIE[$name] = $value; } // Unset over HTTP setcookie($name, $value, $expire); }