當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Profiler::applyConfig方法代碼示例

本文整理匯總了PHP中Magento\Framework\Profiler::applyConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP Profiler::applyConfig方法的具體用法?PHP Profiler::applyConfig怎麽用?PHP Profiler::applyConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\Profiler的用法示例。


在下文中一共展示了Profiler::applyConfig方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: error_reporting

 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
/**
 * Environment initialization
 */
error_reporting(E_ALL);
#ini_set('display_errors', 1);
umask(0);
/* PHP version validation */
if (version_compare(phpversion(), '5.4.11', '<') === true) {
    if (PHP_SAPI == 'cli') {
        echo 'Magento supports PHP 5.4.11 or newer. Please read http://www.magento.com/install.';
    } else {
        echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
    <div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
        <h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;">
        Whoops, it looks like you have an invalid PHP version.</h3>
    </div>
    <p>Magento supports PHP 5.4.11 or newer.
</div>
HTML;
    }
    exit(1);
}
require_once __DIR__ . '/autoload.php';
require_once BP . '/app/functions.php';
if (!empty($_SERVER['MAGE_PROFILER'])) {
    \Magento\Framework\Profiler::applyConfig($_SERVER['MAGE_PROFILER'], BP, !empty($_REQUEST['isAjax']));
}
date_default_timezone_set(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::DEFAULT_TIMEZONE);
開發者ID:buskamuza,項目名稱:magento2-skeleton,代碼行數:31,代碼來源:bootstrap.php

示例2: testApplyConfigWithDrivers

 /**
  * @dataProvider applyConfigDataProvider
  * @param array $config
  * @param array $expectedDrivers
  */
 public function testApplyConfigWithDrivers(array $config, array $expectedDrivers)
 {
     \Magento\Framework\Profiler::applyConfig($config, '');
     $this->assertAttributeEquals($expectedDrivers, '_drivers', 'Magento\\Framework\\Profiler');
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:10,代碼來源:ProfilerTest.php

示例3:

<?php

if (PHP_SAPI != 'cli') {
    $_SERVER['MAGE_PROFILER_STAT'] = new \Magento\Framework\Profiler\Driver\Standard\Stat();
    \Magento\Framework\Profiler::applyConfig(['drivers' => [['output' => 'Mirasvit\\Profiler\\Model\\Driver\\Output\\Html', 'stat' => $_SERVER['MAGE_PROFILER_STAT']]]], BP, false);
}
\Magento\Framework\Component\ComponentRegistrar::register(\Magento\Framework\Component\ComponentRegistrar::MODULE, 'Mirasvit_Profiler', __DIR__);
開發者ID:mirasvit,項目名稱:module-profiler,代碼行數:7,代碼來源:registration.php

示例4: error_reporting

/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
/**
 * Environment initialization
 */
error_reporting(E_ALL);
#ini_set('display_errors', 1);
umask(0);
/* PHP version validation */
if (version_compare(phpversion(), '5.5.0', '<') === true) {
    if (PHP_SAPI == 'cli') {
        echo 'Magento supports PHP 5.5.0 or later. ' . 'Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html';
    } else {
        echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
    <p>Magento supports PHP 5.5.0 or later. Please read
    <a target="_blank" href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html">
    Magento System Requirements</a>.
</div>
HTML;
    }
    exit(1);
}
require_once __DIR__ . '/autoload.php';
require_once BP . '/app/functions.php';
if (!empty($_SERVER['MAGE_PROFILER']) && isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false) {
    \Magento\Framework\Profiler::applyConfig($_SERVER['MAGE_PROFILER'], BP, !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest');
}
date_default_timezone_set('UTC');
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:31,代碼來源:bootstrap.php

示例5: testApplyConfig

 public function testApplyConfig()
 {
     $mockDriver = $this->getMock('Magento\\Framework\\Profiler\\DriverInterface');
     $driverConfig = ['type' => 'foo'];
     $mockDriverFactory = $this->getMockBuilder('Magento\\Framework\\Profiler\\Driver\\Factory')->disableOriginalConstructor()->getMock();
     $config = ['drivers' => [$driverConfig], 'driverFactory' => $mockDriverFactory, 'tagFilters' => ['tagName' => 'tagValue']];
     $mockDriverFactory->expects($this->once())->method('create')->with($driverConfig)->will($this->returnValue($mockDriver));
     \Magento\Framework\Profiler::applyConfig($config, '');
     $this->assertAttributeEquals([$mockDriver], '_drivers', 'Magento\\Framework\\Profiler');
     $this->assertAttributeEquals(['tagName' => ['tagValue']], '_tagFilters', 'Magento\\Framework\\Profiler');
     $this->assertAttributeEquals(true, '_enabled', 'Magento\\Framework\\Profiler');
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:12,代碼來源:ProfilerTest.php


注:本文中的Magento\Framework\Profiler::applyConfig方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。