friendica/src/Factory/ProfilerFactory.php

27 lines
628 B
PHP
Raw Normal View History

2019-02-16 17:11:30 -05:00
<?php
namespace Friendica\Factory;
use Friendica\Core\Config\Cache\IConfigCache;
2019-02-16 17:11:30 -05:00
use Friendica\Util\Profiler;
class ProfilerFactory
{
/**
* Creates a Profiler for the current execution
*
* @param IConfigCache $configCache The configuration cache
2019-02-16 17:11:30 -05:00
*
* @return Profiler
*/
public static function create(IConfigCache $configCache)
2019-02-16 17:11:30 -05:00
{
$enabled = $configCache->get('system', 'profiler');
2019-02-24 07:40:54 -05:00
$enabled = isset($enabled) && $enabled !== '0';
$renderTime = $configCache->get('rendertime', 'callstack');
2019-02-24 07:40:54 -05:00
$renderTime = isset($renderTime) && $renderTime !== '0';
return new Profiler($enabled, $renderTime);
2019-02-16 17:11:30 -05:00
}
}