当前位置: 首页>>代码示例>>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;未经允许,请勿转载。