Invoked by the terminate kernel event.
\Symfony\Component\HttpKernel\Event\PostResponseEvent $event: The event object.
public function onKernelTerminate(PostResponseEvent $event) {
foreach ($this->services as $id) {
// Check if the service was initialized during this request, destruction
// is not necessary if the service was not used.
if ($this->container
->initialized($id)) {
$service = $this->container
->get($id);
$service
->destruct();
}
}
}