當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Container::isScopeActive方法代碼示例

本文整理匯總了PHP中Symfony\Component\DependencyInjection\Container::isScopeActive方法的典型用法代碼示例。如果您正苦於以下問題:PHP Container::isScopeActive方法的具體用法?PHP Container::isScopeActive怎麽用?PHP Container::isScopeActive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\DependencyInjection\Container的用法示例。


在下文中一共展示了Container::isScopeActive方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Constructor
  *
  * @param \Symfony\Component\DependencyInjection\Container $serviceContainer
  */
 public function __construct(Container $serviceContainer)
 {
     if (false === $serviceContainer->isScopeActive('request')) {
         $this->viewType = self::VIEW_NOT_MOBILE;
         return;
     }
     $this->request = $serviceContainer->get('request');
     if ($this->request->query->has(self::SWITCH_PARAM)) {
         $this->viewType = $this->request->query->get(self::SWITCH_PARAM);
     } elseif ($this->request->cookies->has(self::COOKIE_KEY)) {
         $this->viewType = $this->request->cookies->get(self::COOKIE_KEY);
     }
     $this->requestedViewType = $this->viewType;
 }
開發者ID:rhsu14,項目名稱:MobileDetectBundle,代碼行數:19,代碼來源:DeviceView.php

示例2: __construct

 /**
  * Constructor
  *
  * @param \Symfony\Component\DependencyInjection\Container $serviceContainer
  */
 public function __construct(Container $serviceContainer)
 {
     if (false === $serviceContainer->isScopeActive('request')) {
         $this->viewType = self::VIEW_NOT_MOBILE;
         return;
     }
     $this->viewType = self::VIEW_FULL;
     $this->request = $serviceContainer->get('request');
     if ($this->request->query->has(self::SWITCH_PARAM)) {
         $this->viewType = $this->request->query->get(self::SWITCH_PARAM);
     } elseif ($this->request->headers->has(self::HEADER_NAME)) {
         $this->viewType = $this->request->headers->get(self::HEADER_NAME);
     }
     $this->requestedViewType = $this->viewType;
 }
開發者ID:Aldor007,項目名稱:mkaciuba.pl,代碼行數:20,代碼來源:DeviceView.php

示例3: __construct

 /**
  * Constructor
  *
  * @param \Symfony\Component\DependencyInjection\Container $serviceContainer
  */
 public function __construct(Container $serviceContainer)
 {
     if (false === $serviceContainer->isScopeActive('request')) {
         $this->viewType = self::VIEW_NOT_MOBILE;
         return;
     }
     $this->cookieKey = $serviceContainer->getParameter('mobile_detect.cookie_key');
     $this->switchParam = $serviceContainer->getParameter('mobile_detect.switch_param');
     $this->request = $serviceContainer->get('request');
     if ($this->request->query->has($this->switchParam)) {
         $this->viewType = $this->request->query->get($this->switchParam);
     } elseif ($this->request->cookies->has($this->cookieKey)) {
         $this->viewType = $this->request->cookies->get($this->cookieKey);
     }
     $this->requestedViewType = $this->viewType;
 }
開發者ID:mablae,項目名稱:MobileDetectBundle,代碼行數:21,代碼來源:DeviceView.php

示例4: __construct

 /**
  * Constructor
  *
  * @param \Symfony\Component\DependencyInjection\Container $serviceContainer
  * @param array                                            $redirectConf
  */
 public function __construct(Container $serviceContainer, array $redirectConf)
 {
     if (false === $serviceContainer->isScopeActive('request')) {
         $this->viewType = self::VIEW_NOT_MOBILE;
         return;
     }
     $this->request = $serviceContainer->get('request');
     if ($this->request->query->has(self::SWITCH_PARAM)) {
         $this->viewType = $this->request->query->get(self::SWITCH_PARAM);
     } elseif ($this->request->cookies->has(self::COOKIE_KEY)) {
         $this->viewType = $this->request->cookies->get(self::COOKIE_KEY);
     } else {
         if (!empty($redirectConf)) {
             $detectedView = $this->detectViewUsingHost($redirectConf);
             if (!empty($detectedView)) {
                 $this->viewType = $detectedView;
             }
         }
     }
     $this->requestedViewType = $this->viewType;
 }
開發者ID:Viscaweb,項目名稱:MobileDetectBundle,代碼行數:27,代碼來源:DeviceView.php

示例5: testIsScopeActive

 /**
  * @group legacy
  */
 public function testIsScopeActive()
 {
     $c = new Container();
     $this->assertFalse($c->isScopeActive('foo'));
     $c->addScope(new Scope('foo'));
     $this->assertFalse($c->isScopeActive('foo'));
     $c->enterScope('foo');
     $this->assertTrue($c->isScopeActive('foo'));
     $c->leaveScope('foo');
     $this->assertFalse($c->isScopeActive('foo'));
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:14,代碼來源:ContainerTest.php


注:本文中的Symfony\Component\DependencyInjection\Container::isScopeActive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。