Extract item from cookie then delete cookie and return the item.

@param string $key → item to extract

@return string|false → return item or false when key does not exists
356199
public static function pull($key)
    {
        if (isset($_COOKIE[self::$prefix . $key])) {
            setcookie(self::$prefix . $key, '', time() - 3600, '/');

            return $_COOKIE[self::$prefix . $key];
        }

        return false;
    }
591439
public function getItem($key)
    {
        $data = apcu_fetch($key);
        if ($data['ttl'] === 0 || (time() - $data['start'] <= $data['ttl'])) {
            $value = $data['value'];
        } else {
            $this->deleteItem($key);
        }

        return (isset($value)) ? $value : false;
    }
1360512
public function pull($key)
    {
        $item = $this->get($key);

        $this->remove($key);

        return $item;
    }
829519
public function remove($key)
    {
        $value = null;
        if (isset($_SESSION[$key])) {
            $value = $_SESSION[$key];
            unset($_SESSION[$key]);
        }
        return $value;
    }
482708
public function get($key)
    {
        if (isset($this->store[$key])) {
            return filter_var($this->store[$key], FILTER_SANITIZE_STRING);
        }

        return filter_input(INPUT_COOKIE, $key, FILTER_SANITIZE_STRING);
    }
601996
public function pull($key)
    {
        if (!$this->containsKey($key)) {
            return null;
        }
        $removed = $this->items[$key];
        unset($this->items[$key]);

        return $removed;
    }
694985
public function get($key)
	{
		$item = new Item($key);

		if ($this->exists($key))
		{
			$item->setValue(xcache_get($key));
		}

		return $item;
	}
479645
public function pull($key)
    {
        if ($this->has($key)) {
            $pulled = $this->get($key);
            $this->remove($key);
            return $pulled;
        }
        return false;
    }
966597
public function remove($key) {
        $key = $this->secureKey($key);
        
        if (isset($_SESSION[$key])) unset($_SESSION[$key]);
        
        return $key;
    }
42777
public function remove($key)
    {
        if ($this->has($key)) {
            // Set cookie in the past
            $this->set($key, '', -86400);
            // And also make sure it won't be available on the current HTTP request
            unset($this->cookies[$key]);
            return true;
        } else {
            return false;
        }
    }
581750
public function get($key)
	{
		$item = new Item($key);

		if (isset(self::$store[$key]))
		{
			$item->setValue(self::$store[$key]);
		}

		return $item;
	}
334379
public static function getAndRemove(string $key)
    {
        static::startSessionIfNotHasStartedForceWrite();

        $value = static::get($key);
        static::remove($key);

        return $value;
    }
278039
public function getItem($key)
    {
        $cacheFile = __cache_path().md5($key);
        if (file_exists($cacheFile)) {
            $fileHandling = new FileHandling();
            $data = $fileHandling->open($cacheFile, 'readOnly')->read($cacheFile);
            $data = json_decode($data, true);
            if ($data['ttl'] === 0 || (time() - $data['start'] <= $data['ttl'])) {
                $value = $data['value'];
            } else {
                $this->deleteItem($key);
            }
        }

        return (isset($value)) ? $value : false;
    }
521
public function cookie($key)
    {
        deprecationWarning(
            'ServerRequest::cookie() is deprecated. ' .
            'Use getCookie() instead.'
        );

        if (isset($this->cookies[$key])) {
            return $this->cookies[$key];
        }

        return null;
    }
671797
public function delete($key = '')
    {
        try {
            if ($this->cacheInstance !== NULL && is_object($this->cacheInstance)) {
                /**
                 * @var $cache object
                 */
                if (is_array($key)) {
                    $result = $this->cacheInstance->deleteItems($key);
                } else {
                    $result = $this->cacheInstance->deleteItem($key);
                }
                $message = 'Final Delete Content from Key: ' . $key . ' => Output result: ' . json_encode($result);
                $this->debug->info(__FUNCTION__, $message);

                return $result;
            } else {
                $this->debug->error(__FUNCTION__, 'Unavailable cacheInstance');

                return NULL;
            }
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return $message;
        }
    }
503513
public function get($key)
    {
        if (isset($this->cache[$key])) {
            list($expires, $value) = $this->cache[$key];
            if (!$expires || ($expires >= microtime(true))) {
                return $value;
            }
            unset($this->cache[$key]);
        }
        return false;
    }
121108
public function getAndRemove($key)
    {
        $data = $this->get($key);
        if ($data) {
            $this->remove($key);
        }
        return $data;
    }