本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\SessionInterface::has方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionInterface::has方法的具体用法?PHP SessionInterface::has怎么用?PHP SessionInterface::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Session\SessionInterface
的用法示例。
在下文中一共展示了SessionInterface::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasToken
/**
* {@inheritdoc}
*/
public function hasToken($tokenId)
{
if (!$this->session->isStarted()) {
$this->session->start();
}
return $this->session->has($this->namespace . '/' . $tokenId);
}
示例2: hasData
/**
* {@inheritdoc}
*/
public function hasData($key)
{
if (!$this->session->isStarted()) {
return false;
}
return $this->session->has($key);
}
示例3: getLoggedUser
/**
* @return \PHPSC\Conference\Domain\Entity\User
*/
public function getLoggedUser()
{
if (!$this->isLogged() && $this->session->has('loggedUser')) {
$this->loggedUser = $this->userManager->getById($this->session->get('loggedUser'));
}
return $this->loggedUser;
}
示例4: getItemCount
/**
* @return int
*/
public function getItemCount()
{
if (!$this->session->has(self::QUOTE_SESSION_ITEM_COUNT_IDENTIFIER)) {
return 0;
}
return $this->session->get(self::QUOTE_SESSION_ITEM_COUNT_IDENTIFIER);
}
示例5: checkTaskSkipped
/**
* @param Task $task
* @return bool true if task is skipped
*/
public function checkTaskSkipped(Task $task)
{
if (!$this->session) {
return false;
}
return $this->session->has($this->getSessionKey($task));
}
示例6: getHost
/**
* @return string
*/
public function getHost()
{
if ($this->session->isStarted() && $this->session->has(self::OVERRIDE_HOST)) {
return $this->session->get(self::OVERRIDE_HOST);
}
return parent::getHost();
}
示例7: hasEditId
/**
* @return bool
*/
public function hasEditId()
{
if (!$this->session->has('scribe.digitalhub.editId')) {
return false;
}
return true;
}
示例8: getId
/**
* {@inheritdoc}
*/
protected function getId($create = TRUE)
{
if ($this->currentUser->isAuthenticated()) {
return $this->currentUser->id();
} elseif (!$this->session->has('uc_cart_id') && $create) {
$this->session->set('uc_cart_id', md5(uniqid(rand(), TRUE)));
}
return $this->session->has('uc_cart_id') ? $this->session->get('uc_cart_id') : FALSE;
}
示例9: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
$last5Board = $this->getRepository(Board::class)->getLast5BoardsByClientId($session->get('client/id'));
$recentBoard = null;
if ($session->has('last_selected_board_id')) {
$recentBoard = $this->getRepository(Board::class)->getById($session->has('last_selected_board_id'));
}
$clientAdministratorFlag = $session->get('user/client_administrator_flag');
return $this->render(__DIR__ . '/../../Resources/views/menu/Agile.php', get_defined_vars());
}
示例10: 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;
}
示例11: get
/**
* @return Comunidad|mixed|null|object
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
* @throws \Doctrine\ORM\TransactionRequiredException
*/
public function get()
{
if ($this->comunidad instanceof Comunidad) {
return $this->comunidad;
}
if ($this->session->has('comunidad')) {
$comunidad = $this->session->get('comunidad');
$this->comunidad = $this->em->merge($comunidad);
return $this->comunidad;
}
return null;
}
示例12: onKernelException
/**
* Handle errors thrown in the application.
*
* @param GetResponseForExceptionEvent $event
*/
public function onKernelException(GetResponseForExceptionEvent $event)
{
$hasUser = $this->session->isStarted() && $this->session->has('authentication');
if (!$hasUser && !$this->showWhileLoggedOff) {
return;
}
$exception = $event->getException();
ob_start();
$this->whoops->handleException($exception);
$response = ob_get_clean();
$code = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : Response::HTTP_INTERNAL_SERVER_ERROR;
$event->setResponse(new Response($response, $code));
}
示例13: hasValid
/**
* Return if the translations are saved in the session
*
* @param string $key
* @return bool
*/
public function hasValid($key = self::DEFAULT_KEY)
{
if (!$this->session->has($key)) {
return false;
}
$rawTranslations = $this->session->get($key);
if (!is_array($rawTranslations)) {
return false;
}
if (!isset($rawTranslations['bundles']) || !isset($rawTranslations['domains']) || !isset($rawTranslations['locales']) || !isset($rawTranslations['bundles']) || !isset($rawTranslations['messages'])) {
return false;
}
return true;
}
示例14: 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;
}
示例15: withCsrfTokenHeader
private function withCsrfTokenHeader(Response $response, SessionInterface $session)
{
if ($session->has('csrf_token')) {
$response = $response->withHeader('X-CSRF-Token', $session->get('csrf_token'));
}
return $response;
}