本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\SessionInterface::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionInterface::remove方法的具体用法?PHP SessionInterface::remove怎么用?PHP SessionInterface::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Session\SessionInterface
的用法示例。
在下文中一共展示了SessionInterface::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
/**
* @param string $id
* @return void
*/
public function remove($id)
{
if (!is_string($id)) {
throw InvalidArgumentException::invalidType('string', 'uuid', $id);
}
return $this->session->remove(sprintf('%s:%s', $this->namespace, $id));
}
示例2: removeInstallmentPayments
/**
* @return bool
*/
public function removeInstallmentPayments()
{
if ($this->hasInstallmentPayments()) {
$this->session->remove(self::PAYOLUTION_SESSION_IDENTIFIER);
return true;
}
return false;
}
示例3: testInitializeFromDatabase
public function testInitializeFromDatabase()
{
$this->session->remove('stack');
$this->users->expects($this->once())->method('getCurrentUser')->willReturn(['stack' => ['a.txt']]);
$this->filesystem->put('files://a.txt', '');
$this->stack->getList();
$this->assertEquals(['files://a.txt'], $this->session->get('stack'), 'Initializing stack from database should cache list in session');
}
示例4: fetch
/**
* {@inheritDoc}
*/
public function fetch(ResourceOwnerInterface $resourceOwner, $key, $type = 'token')
{
$key = $this->generateKey($resourceOwner, $key, $type);
if (null === ($token = $this->session->get($key))) {
throw new \InvalidArgumentException('No data available in storage.');
}
// request tokens are one time use only
$this->session->remove($key);
return $token;
}
示例5: onFormSetData
/**
* @param FormEvent $event
*/
public function onFormSetData(FormEvent $event)
{
$error = $this->session->get(SecurityContextInterface::AUTHENTICATION_ERROR);
// Remove error so it isnt persisted
$this->session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
if ($error) {
$event->getForm()->addError(new FormError($error->getMessage()));
}
$event->setData(array('_username' => $this->session->get(SecurityContextInterface::LAST_USERNAME)));
}
示例6: deleteCartId
/**
* {@inheritdoc}
*/
public function deleteCartId($cart_id)
{
$ids = $this->session->get('commerce_cart_orders', []);
$ids = array_diff($ids, [$cart_id]);
if (!empty($ids)) {
$this->session->set('commerce_cart_orders', $ids);
} else {
// Remove the empty list to allow the system to clean up empty sessions.
$this->session->remove('commerce_cart_orders');
}
}
示例7: getCart
/**
* {@inheritdoc}
*/
public function getCart()
{
if (!$this->session->has($this->sessionKeyName)) {
throw new CartNotFoundException('Sylius was not able to find the cart in session');
}
$cart = $this->cartRepository->findCartById($this->session->get($this->sessionKeyName));
if (null === $cart) {
$this->session->remove($this->sessionKeyName);
throw new CartNotFoundException('Sylius was not able to find the cart in session');
}
return $cart;
}
示例8: isStateValid
/**
* @param string $state
* @return bool
*/
public function isStateValid($state)
{
if (!$state) {
return false;
}
$sessionState = $this->session->get(self::STATE_SESSION_KEY);
$this->session->remove(self::STATE_SESSION_KEY);
if ($state != $sessionState) {
return false;
}
return true;
}
示例9: purgeSessionCrumbs
protected function purgeSessionCrumbs($crumbs)
{
if (!$this->hasStoredCrumbs()) {
return;
}
$depth = $this->getDepth($crumbs);
$storedArray = $this->getFromSession();
$purgedArray = $this->removeIndexesFrom($storedArray, $depth);
if (!$purgedArray) {
$this->session->remove($this->sessionKey);
return;
}
$this->session->set($this->sessionKey, $purgedArray);
}
示例10: getExpectedCode
/**
* Retrieve the CAPTCHA code
*
*@param $key
*
* @return mixed|null
*/
protected function getExpectedCode($key)
{
$arrayZendSession = new SessionArrayStorage();
if ($this->session->has($key)) {
$sessionKey = $this->session->get($key);
$this->session->remove($key);
$captchaSession = $arrayZendSession->offsetGet($sessionKey);
$arrayZendSession->offsetUnset($sessionKey);
if ($captchaSession instanceof ArrayObject) {
$word = $captchaSession->offsetGet('word');
$captchaSession->offsetUnset('word');
return $word;
}
}
return null;
}
示例11: check
/**
* 验证并删除验证码
* @param $input
* @return bool
*/
public function check($input)
{
$result = $this->test($input);
//从Session中删除code
$this->store->remove($this->getFullName());
return $result;
}
示例12: removeToken
/**
* {@inheritdoc}
*/
public function removeToken($tokenId)
{
if (!$this->session->isStarted()) {
$this->session->start();
}
return $this->session->remove($this->namespace . '/' . $tokenId);
}
示例13: testRemove
/**
* @dataProvider setProvider
*/
public function testRemove($key, $value)
{
$this->session->set('hi.world', 'have a nice day');
$this->session->set($key, $value);
$this->session->remove($key);
$this->assertEquals(array('hi.world' => 'have a nice day'), $this->session->all());
}
示例14: logout
/**
* @inheritdoc
*/
public function logout()
{
LoggerRegistry::debug('SitegearUserManager::logout()');
$this->session->remove(self::SESSION_KEY_USER_EMAIL);
$this->session->remove(self::SESSION_KEY_USER_IS_GUEST);
return true;
}
示例15: getCart
/**
* {@inheritdoc}
*/
public function getCart()
{
try {
$channel = $this->channelContext->getChannel();
} catch (ChannelNotFoundException $exception) {
throw new CartNotFoundException($exception);
}
if (!$this->session->has(sprintf('%s.%s', $this->sessionKeyName, $channel->getCode()))) {
throw new CartNotFoundException('Sylius was not able to find the cart in session');
}
$cart = $this->orderRepository->findCartByIdAndChannel($this->session->get(sprintf('%s.%s', $this->sessionKeyName, $channel->getCode())), $channel);
if (null === $cart) {
$this->session->remove(sprintf('%s.%s', $this->sessionKeyName, $channel->getCode()));
throw new CartNotFoundException('Sylius was not able to find the cart in session');
}
return $cart;
}