]> git.mxchange.org Git - friendica.git/blob - src/Factory/ProfilerFactory.php
Merge pull request #6641 from nupplaphil/config_followup
[friendica.git] / src / Factory / ProfilerFactory.php
1 <?php
2
3 namespace Friendica\Factory;
4
5 use Friendica\Core\Config\Cache\IConfigCache;
6 use Friendica\Util\Profiler;
7
8 class ProfilerFactory
9 {
10         /**
11          * Creates a Profiler for the current execution
12          *
13          * @param IConfigCache     $configCache The configuration cache
14          *
15          * @return Profiler
16          */
17         public static function create(IConfigCache $configCache)
18         {
19                 $enabled = $configCache->get('system', 'profiler');
20                 $enabled = isset($enabled) && $enabled !== '!<unset>!';
21                 $renderTime = $configCache->get('rendertime', 'callstack');
22                 $renderTime = isset($renderTime) && $renderTime !== '!<unset>!';
23
24                 return new Profiler($enabled, $renderTime);
25         }
26 }