/**
* Invoked by the terminate kernel event.
*
* @param \Symfony\Component\HttpKernel\Event\TerminateEvent $event
* The event object.
*/
public function onKernelTerminate(TerminateEvent
$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();
} } } /**
* Registers the methods in this class that should be listeners.
*
* @return array
* An array of event listener definitions.
*/