本文整理汇总了PHP中Bolt\Controller\Zone::isAsync方法的典型用法代码示例。如果您正苦于以下问题:PHP Zone::isAsync方法的具体用法?PHP Zone::isAsync怎么用?PHP Zone::isAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bolt\Controller\Zone
的用法示例。
在下文中一共展示了Zone::isAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testControllerZone
/**
* @covers \Bolt\Controller\Zone::get
* @covers \Bolt\Controller\Zone::isAsync
*/
public function testControllerZone()
{
$app = $this->getApp();
$this->allowLogin($app);
$this->setRequest(Request::create('/async'));
$request = $this->getRequest();
$kernel = $this->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface');
$app['dispatcher']->dispatch(KernelEvents::REQUEST, new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST));
$this->assertEquals('async', Zone::get($request));
$this->assertTrue(Zone::isAsync($request));
}
示例2: onResponse
/**
* Callback for reponse event.
*
* @param FilterResponseEvent $event
*/
public function onResponse(FilterResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$response = $event->getResponse();
if (strpos($response->headers->get('Content-Type'), 'text/html') === false) {
return;
}
if (!Zone::isAsync($event->getRequest())) {
$this->addSnippets();
}
$response->setContent($this->render->postProcess($response));
}