本文整理汇总了PHP中Magento\Framework\Profiler::isEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Profiler::isEnabled方法的具体用法?PHP Profiler::isEnabled怎么用?PHP Profiler::isEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Profiler
的用法示例。
在下文中一共展示了Profiler::isEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAdd
public function testAdd()
{
$mock = $this->_getDriverMock();
\Magento\Framework\Profiler::add($mock);
$this->assertTrue(\Magento\Framework\Profiler::isEnabled());
$expected = [$mock];
$this->assertAttributeEquals($expected, '_drivers', 'Magento\\Framework\\Profiler');
}
示例2: create
/**
* Create ObjectManager
*
* @param array $arguments
* @return \Magento\Framework\ObjectManagerInterface
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function create(array $arguments)
{
$deploymentConfig = $this->createDeploymentConfig($this->directoryList, $this->configFilePool, $arguments);
$arguments = array_merge($deploymentConfig->get(), $arguments);
$definitionFactory = new \Magento\Framework\ObjectManager\DefinitionFactory($this->driverPool->getDriver(DriverPool::FILE), $this->directoryList->getPath(DirectoryList::DI), $this->directoryList->getPath(DirectoryList::GENERATION), $deploymentConfig->get(self::CONFIG_PATH_DEFINITION_FORMAT, Serialized::MODE_NAME));
$definitions = $definitionFactory->createClassDefinition($deploymentConfig->get('definitions'));
$relations = $definitionFactory->createRelations();
/** @var EnvironmentFactory $enFactory */
$enFactory = new $this->envFactoryClassName($relations, $definitions);
/** @var EnvironmentInterface $env */
$env = $enFactory->createEnvironment();
/** @var ConfigInterface $diConfig */
$diConfig = $env->getDiConfig();
$appMode = isset($arguments[State::PARAM_MODE]) ? $arguments[State::PARAM_MODE] : State::MODE_DEFAULT;
$booleanUtils = new \Magento\Framework\Stdlib\BooleanUtils();
$argInterpreter = $this->createArgumentInterpreter($booleanUtils);
$argumentMapper = new \Magento\Framework\ObjectManager\Config\Mapper\Dom($argInterpreter);
if ($env->getMode() != Environment\Compiled::MODE) {
$configData = $this->_loadPrimaryConfig($this->directoryList, $this->driverPool, $argumentMapper, $appMode);
if ($configData) {
$diConfig->extend($configData);
}
}
// set cache profiler decorator if enabled
if (\Magento\Framework\Profiler::isEnabled()) {
$cacheFactoryArguments = $diConfig->getArguments('Magento\\Framework\\App\\Cache\\Frontend\\Factory');
$cacheFactoryArguments['decorators'][] = ['class' => 'Magento\\Framework\\Cache\\Frontend\\Decorator\\Profiler', 'parameters' => ['backendPrefixes' => ['Zend_Cache_Backend_', 'Cm_Cache_Backend_']]];
$cacheFactoryConfig = ['Magento\\Framework\\App\\Cache\\Frontend\\Factory' => ['arguments' => $cacheFactoryArguments]];
$diConfig->extend($cacheFactoryConfig);
}
$sharedInstances = ['Magento\\Framework\\App\\DeploymentConfig' => $deploymentConfig, 'Magento\\Framework\\App\\Filesystem\\DirectoryList' => $this->directoryList, 'Magento\\Framework\\Filesystem\\DirectoryList' => $this->directoryList, 'Magento\\Framework\\Filesystem\\DriverPool' => $this->driverPool, 'Magento\\Framework\\ObjectManager\\RelationsInterface' => $relations, 'Magento\\Framework\\Interception\\DefinitionInterface' => $definitionFactory->createPluginDefinition(), 'Magento\\Framework\\ObjectManager\\ConfigInterface' => $diConfig, 'Magento\\Framework\\Interception\\ObjectManager\\ConfigInterface' => $diConfig, 'Magento\\Framework\\ObjectManager\\DefinitionInterface' => $definitions, 'Magento\\Framework\\Stdlib\\BooleanUtils' => $booleanUtils, 'Magento\\Framework\\ObjectManager\\Config\\Mapper\\Dom' => $argumentMapper, 'Magento\\Framework\\ObjectManager\\ConfigLoaderInterface' => $env->getObjectManagerConfigLoader(), $this->_configClassName => $diConfig];
$arguments['shared_instances'] =& $sharedInstances;
$this->factory = $env->getObjectManagerFactory($arguments);
/** @var \Magento\Framework\ObjectManagerInterface $objectManager */
$objectManager = new $this->_locatorClassName($this->factory, $diConfig, $sharedInstances);
$this->factory->setObjectManager($objectManager);
ObjectManager::setInstance($objectManager);
$definitionFactory->getCodeGenerator()->setObjectManager($objectManager);
$env->configureObjectManager($diConfig, $sharedInstances);
return $objectManager;
}