当前位置: 首页>>代码示例>>PHP>>正文


PHP Profiler::reset方法代码示例

本文整理汇总了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));
 }
开发者ID:nja78,项目名称:magento2,代码行数:37,代码来源:Render.php

示例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;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:26,代码来源:StaticResource.php

示例3: tearDown

 protected function tearDown()
 {
     \Magento\Framework\Profiler::reset();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:4,代码来源:ProfilerTest.php

示例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');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:ProfilerTest.php


注:本文中的Magento\Framework\Profiler::reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。