From 8396888ee264bff674c40383bd5cc0eb0cd4e7b2 Mon Sep 17 00:00:00 2001 From: Andrey Savchenko Date: Thu, 8 Feb 2018 18:10:01 +0200 Subject: [PATCH] Moved leftover event stop to the provider. --- src/Events/Hook_Events_Provider.php | 4 ++++ src/Laps.php | 7 ------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Events/Hook_Events_Provider.php b/src/Events/Hook_Events_Provider.php index c8bd851..d25f59e 100644 --- a/src/Events/Hook_Events_Provider.php +++ b/src/Events/Hook_Events_Provider.php @@ -101,6 +101,10 @@ class Hook_Events_Provider implements ServiceProviderInterface, Bootable_Provide public function get_events() { + if ( $this->stopwatch->isStarted( 'Toolbar' ) ) { + $this->stopwatch->stop( 'Toolbar' ); + } + $events = $this->stopwatch->getSectionEvents( '__root__' ); return array_map( [ $this, 'transform' ], array_keys( $events ), $events ); diff --git a/src/Laps.php b/src/Laps.php index 4ae35d2..7a75754 100644 --- a/src/Laps.php +++ b/src/Laps.php @@ -131,13 +131,6 @@ class Laps extends Container { global $timestart; - /** @var Stopwatch $stopwatch */ - $stopwatch = $this['stopwatch']; - - if ( $stopwatch->isStarted( 'Toolbar' ) ) { - $stopwatch->stop( 'Toolbar' ); - } - $events = []; foreach ( $this->providers as $provider ) {