Added keys to collectors array.

This commit is contained in:
Andrey Savchenko committed 2018-02-13 18:16:41 +02:00
1 parent c74051e87d
commit 53efcd28af
2 files changed
+8 -12

No files matched your search

+4 -4
View File
@@ -21,9 +21,9 @@ class Record_Provider implements ServiceProviderInterface, Bootable_Provider_Int
$pimple['collectors'] = function ( Laps $laps ) {
return [
new Hook_Record_Collector( $laps['hook.events'], $laps['stopwatch'] ),
new Http_Record_Collector( $laps['stopwatch'] ),
new Sql_Record_Collector(),
'hook' => new Hook_Record_Collector( $laps['hook.events'], $laps['stopwatch'] ),
'http' => new Http_Record_Collector( $laps['stopwatch'] ),
'sql' => new Sql_Record_Collector(),
];
};
@@ -33,7 +33,7 @@ class Record_Provider implements ServiceProviderInterface, Bootable_Provider_Int
/** @var Record_Collector_Interface $collector */
foreach ( $laps['collectors'] as $collector ) {
$records[] = $collector->get_records();
$records[] = $collector->get_records();
}
return array_merge( ...$records );
+4 -8
View File
@@ -3,7 +3,6 @@
namespace Rarst\Laps\Record;
use Rarst\Laps\Event\Hook_Event_Config_Interface;
use Rarst\Laps\Events\Laps_Events;
use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\Stopwatch\StopwatchEvent;
@@ -79,13 +78,10 @@ class Hook_Record_Collector implements Record_Collector_Interface {
return $input;
}
$event = wp_parse_args(
$this->events[ $filter_name ][ $priority ],
[
'action' => 'start',
'category' => null,
]
);
$event = wp_parse_args( $this->events[ $filter_name ][ $priority ], [
'action' => 'start',
'category' => null,
] );
if ( 'stop' === $event['action'] && ! $this->stopwatch->isStarted( $event['event'] ) ) {
return $input;