2019-02-16 17:11:30 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Friendica\Factory;
|
|
|
|
|
2019-02-17 15:12:12 -05:00
|
|
|
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
|
|
|
|
*
|
2019-02-17 15:12:12 -05:00
|
|
|
* @param IConfigCache $configCache The configuration cache
|
2019-02-16 17:11:30 -05:00
|
|
|
*
|
|
|
|
* @return Profiler
|
|
|
|
*/
|
2019-02-17 15:12:12 -05:00
|
|
|
public static function create(IConfigCache $configCache)
|
2019-02-16 17:11:30 -05:00
|
|
|
{
|
2019-02-17 15:12:12 -05:00
|
|
|
$enabled = $configCache->get('system', 'profiler');
|
|
|
|
$enabled = isset($enabled) && $enabled !== '!<unset>!';
|
|
|
|
$renderTime = $configCache->get('rendertime', 'callstack');
|
|
|
|
$renderTime = isset($renderTime) && $renderTime !== '!<unset>!';
|
|
|
|
|
|
|
|
return new Profiler($enabled, $renderTime);
|
2019-02-16 17:11:30 -05:00
|
|
|
}
|
|
|
|
}
|