本文整理匯總了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'));
}