Changed Stopwatch service to a factory.
This commit is contained in:
1 parent
054bf2e0df
commit
c93249875b
2 files changed
+8
-3
No files matched your search
@@ -8,7 +8,7 @@ use Rarst\Laps\Bootable_Provider_Interface;
|
|||||||
use Rarst\Laps\Laps;
|
use Rarst\Laps\Laps;
|
||||||
use Symfony\Component\Stopwatch\Stopwatch;
|
use Symfony\Component\Stopwatch\Stopwatch;
|
||||||
|
|
||||||
class Http_Events_Provider implements ServiceProviderInterface, Bootable_Provider_Interface {
|
class Http_Events_Provider implements ServiceProviderInterface, Bootable_Provider_Interface, Events_Provider_Interface {
|
||||||
|
|
||||||
/** @var Stopwatch $stopwatch */
|
/** @var Stopwatch $stopwatch */
|
||||||
protected $stopwatch;
|
protected $stopwatch;
|
||||||
@@ -58,4 +58,9 @@ class Http_Events_Provider implements ServiceProviderInterface, Bootable_Provide
|
|||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_events() {
|
||||||
|
|
||||||
|
return $this->stopwatch->getSectionEvents( '__root__' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -31,9 +31,9 @@ class Laps extends Container {
|
|||||||
] );
|
] );
|
||||||
};
|
};
|
||||||
|
|
||||||
$laps['stopwatch'] = function () {
|
$laps['stopwatch'] = $laps->factory( function () {
|
||||||
return new Stopwatch();
|
return new Stopwatch();
|
||||||
};
|
} );
|
||||||
|
|
||||||
$laps->register( new Hook_Events_Provider() );
|
$laps->register( new Hook_Events_Provider() );
|
||||||
$laps->register( new Http_Events_Provider() );
|
$laps->register( new Http_Events_Provider() );
|
||||||
|
|||||||
Reference in new issue
Block a user