当前位置: 首页>>代码示例>>PHP>>正文


PHP SessionInterface::has方法代码示例

本文整理汇总了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);
 }
开发者ID:ayoah,项目名称:symfony,代码行数:10,代码来源:SessionTokenStorage.php

示例2: hasData

 /**
  * {@inheritdoc}
  */
 public function hasData($key)
 {
     if (!$this->session->isStarted()) {
         return false;
     }
     return $this->session->has($key);
 }
开发者ID:Avazanga1,项目名称:Sylius,代码行数:10,代码来源:SessionStorage.php

示例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;
 }
开发者ID:scdevsummit,项目名称:phpsc-conf,代码行数:10,代码来源:AuthenticationService.php

示例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);
 }
开发者ID:spryker,项目名称:Cart,代码行数:10,代码来源:QuoteSession.php

示例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));
 }
开发者ID:redelivre,项目名称:login-cidadao,代码行数:11,代码来源:TasksManager.php

示例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();
 }
开发者ID:Amrit01,项目名称:KunstmaanBundlesCMS,代码行数:10,代码来源:DomainConfiguration.php

示例7: hasEditId

 /**
  * @return bool
  */
 public function hasEditId()
 {
     if (!$this->session->has('scribe.digitalhub.editId')) {
         return false;
     }
     return true;
 }
开发者ID:src-run,项目名称:file-uploader-bundle,代码行数:10,代码来源:FileUploaderHelper.php

示例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;
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:12,代码来源:CartManager.php

示例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());
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:10,代码来源:AgileController.php

示例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;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:15,代码来源:SessionBasedCartContext.php

示例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;
 }
开发者ID:javiermadueno,项目名称:futbol,代码行数:18,代码来源:ComunidadProvider.php

示例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));
 }
开发者ID:jkaan,项目名称:timOnlineBolt,代码行数:18,代码来源:WhoopsListener.php

示例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;
 }
开发者ID:davamigo,项目名称:translator-bundle,代码行数:20,代码来源:SessionStorage.php

示例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;
 }
开发者ID:Open-Wide,项目名称:ZendCaptchaBundle,代码行数:23,代码来源:ZendCaptchaValidator.php

示例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;
 }
开发者ID:Luceos,项目名称:core,代码行数:7,代码来源:StartSession.php


注:本文中的Symfony\Component\HttpFoundation\Session\SessionInterface::has方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。