Refactored DependencyFactory for Profiler
This commit is contained in:
parent
cdcf1667d7
commit
5e5c39b0e1
12 changed files with 65 additions and 47 deletions
|
@ -2,24 +2,25 @@
|
|||
|
||||
namespace Friendica\Factory;
|
||||
|
||||
use Friendica\Core\Config\ConfigCache;
|
||||
use Friendica\Core\Config\Cache\IConfigCache;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ProfilerFactory
|
||||
{
|
||||
/**
|
||||
* Creates a Profiler for the current execution
|
||||
*
|
||||
* @param LoggerInterface $logger The logger for saving the profiling data
|
||||
* @param ConfigCache $configCache The configuration cache
|
||||
* @param IConfigCache $configCache The configuration cache
|
||||
*
|
||||
* @return Profiler
|
||||
*/
|
||||
public static function create(LoggerInterface $logger, ConfigCache $configCache)
|
||||
public static function create(IConfigCache $configCache)
|
||||
{
|
||||
$enabled = $configCache->get('system', 'profiler', false);
|
||||
$renderTime = $configCache->get('rendertime', 'callstack', false);
|
||||
return new Profiler($logger, $enabled, $renderTime);
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue