本文整理汇总了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);
示例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');
}
示例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__);
示例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');
示例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');
}