本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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'));
}