本文整理汇总了PHP中Magento\Framework\Profiler::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP Profiler::reset方法的具体用法?PHP Profiler::reset怎么用?PHP Profiler::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Profiler
的用法示例。
在下文中一共展示了Profiler::reset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Returns block content depends on ajax request
*
* @return void
*/
public function execute()
{
if (!$this->getRequest()->isAjax()) {
$this->_forward('noroute');
return;
}
// disable profiling during private content handling AJAX call
\Magento\Framework\Profiler::reset();
$currentRoute = $this->getRequest()->getRouteName();
$currentControllerName = $this->getRequest()->getControllerName();
$currentActionName = $this->getRequest()->getActionName();
$currentRequestUri = $this->getRequest()->getRequestUri();
$origRequest = $this->getRequest()->getParam('originalRequest');
$origRequest = json_decode($origRequest, true);
$this->getRequest()->setRouteName($origRequest['route']);
$this->getRequest()->setControllerName($origRequest['controller']);
$this->getRequest()->setActionName($origRequest['action']);
$this->getRequest()->setRequestUri($origRequest['uri']);
/** @var \Magento\Framework\View\Element\BlockInterface[] $blocks */
$blocks = $this->_getBlocks();
$data = [];
foreach ($blocks as $blockName => $blockInstance) {
$data[$blockName] = $blockInstance->toHtml();
}
$this->getRequest()->setRouteName($currentRoute);
$this->getRequest()->setControllerName($currentControllerName);
$this->getRequest()->setActionName($currentActionName);
$this->getRequest()->setRequestUri($currentRequestUri);
$this->getResponse()->setPrivateHeaders(\Magento\PageCache\Helper\Data::PRIVATE_MAX_AGE_CACHE);
$this->translateInline->processResponseBody($data);
$this->getResponse()->appendBody(json_encode($data));
}
示例2: launch
/**
* Finds requested resource and provides it to the client
*
* @return \Magento\Framework\App\ResponseInterface
* @throws \Exception
*/
public function launch()
{
// disabling profiling when retrieving static resource
\Magento\Framework\Profiler::reset();
$appMode = $this->state->getMode();
if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION) {
$this->response->setHttpResponseCode(404);
} else {
$path = $this->request->get('resource');
$params = $this->parsePath($path);
$this->state->setAreaCode($params['area']);
$this->objectManager->configure($this->configLoader->load($params['area']));
$file = $params['file'];
unset($params['file']);
$asset = $this->assetRepo->createAsset($file, $params);
$this->response->setFilePath($asset->getSourceFile());
$this->publisher->publish($asset);
}
return $this->response;
}
示例3: tearDown
protected function tearDown()
{
\Magento\Framework\Profiler::reset();
}
示例4: testResetProfiler
public function testResetProfiler()
{
$driver = $this->_getDriverMock();
$driver->expects($this->once())->method('clear')->with(null);
\Magento\Framework\Profiler::add($driver);
\Magento\Framework\Profiler::reset();
$this->assertAttributeEquals([], '_currentPath', 'Magento\\Framework\\Profiler');
$this->assertAttributeEquals([], '_tagFilters', 'Magento\\Framework\\Profiler');
$this->assertAttributeEquals([], '_defaultTags', 'Magento\\Framework\\Profiler');
$this->assertAttributeEquals([], '_drivers', 'Magento\\Framework\\Profiler');
$this->assertAttributeEquals(false, '_hasTagFilters', 'Magento\\Framework\\Profiler');
$this->assertAttributeEquals(0, '_pathCount', 'Magento\\Framework\\Profiler');
$this->assertAttributeEquals([], '_pathIndex', 'Magento\\Framework\\Profiler');
}