diff --git a/src/Bootable_Provider_Interface.php b/src/Bootable_Provider_Interface.php new file mode 100644 index 0000000..e9e9374 --- /dev/null +++ b/src/Bootable_Provider_Interface.php @@ -0,0 +1,10 @@ +providers[] = $provider; + + parent::register( $provider, $values ); + + return $this; + } + /** * Start Stopwatch and timing plugin load immediately, then set up core events and needed hooks. */ @@ -50,6 +63,13 @@ class Laps extends Container { $events = new Core_Events(); $this->add_events( $events->get() ); + foreach ( $this->providers as $provider ) { + + if ( $provider instanceof Bootable_Provider_Interface ) { + $provider->boot( $this ); + } + } + add_action( 'pre_update_option_active_plugins', array( $this, 'pre_update_option_active_plugins' ) ); add_action( 'pre_update_site_option_active_sitewide_plugins', array( $this, 'pre_update_option_active_plugins' ) ); add_action( 'pre_http_request', array( $this, 'pre_http_request' ), 10, 3 ); @@ -248,7 +268,16 @@ class Laps extends Container { $stopwatch->stop( 'Toolbar' ); } - $events = $stopwatch->getSectionEvents( '__root__' ); + $events = []; + + foreach ( $this->providers as $provider ) { + + if ( $provider instanceof Events_Provider_Interface ) { + $events[] = $provider->get_events(); + } + } + + $events = array_merge(...$events); $start = $timestart * 1000; $end = microtime( true ) * 1000; $total = $end - $start;