| 1 | <?php |
||
| 2 | |||
| 3 | namespace LeKoala\DebugBar\Extension; |
||
| 4 | |||
| 5 | use LeKoala\DebugBar\DebugBar; |
||
| 6 | use SilverStripe\Core\Extension; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @author Koala |
||
| 10 | */ |
||
| 11 | class LeftAndMainExtension extends Extension |
||
| 12 | { |
||
| 13 | public function accessedCMS() |
||
| 14 | { |
||
| 15 | DebugBar::withDebugBar(function (\DebugBar\DebugBar $debugbar) { |
||
| 16 | /** @var DebugBar\DataCollector\TimeDataCollector $timeData */ |
||
| 17 | $timeData = $debugbar->getCollector('time'); |
||
| 18 | if (!$timeData) { |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 19 | return; |
||
| 20 | } |
||
| 21 | if ($timeData->hasStartedMeasure("init")) { |
||
| 22 | $timeData->stopMeasure("init"); |
||
| 23 | } |
||
| 24 | $timeData->startMeasure("cms_accessed", "cms accessed"); |
||
| 25 | }); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function init() |
||
| 29 | { |
||
| 30 | DebugBar::withDebugBar(function (\DebugBar\DebugBar $debugbar) { |
||
| 31 | /** @var DebugBar\DataCollector\TimeDataCollector $timeData */ |
||
| 32 | $timeData = $debugbar->getCollector('time'); |
||
| 33 | if (!$timeData) { |
||
|
0 ignored issues
–
show
|
|||
| 34 | return; |
||
| 35 | } |
||
| 36 | if ($timeData->hasStartedMeasure("cms_accessed")) { |
||
| 37 | $timeData->stopMeasure("cms_accessed"); |
||
| 38 | } |
||
| 39 | $timeData->startMeasure("cms_init", "cms init"); |
||
| 40 | }); |
||
| 41 | } |
||
| 42 | } |
||
| 43 |