Example #1
0
 /**
  * Reboot.
  *
  * Shutdown the system flushing all event handlers, services and service arguments.
  *
  * @return void
  */
 public function reboot()
 {
     $event = new GenericEvent($this);
     $this->dispatcher->dispatch('shutdown', $event);
     // flush handlers
     foreach ($this->dispatcher->getListeners() as $eventName => $listener) {
         $this->dispatcher->removeListener($eventName, $listener);
     }
     // flush all services
     $services = $this->container->getServiceIds();
     rsort($services);
     foreach ($services as $id) {
         if (!in_array($id, array('zikula', 'service_container', 'event_dispatcher'))) {
             $this->container->removeDefinition($id);
         }
     }
     // flush arguments.
     $this->container->setArguments(array());
     $this->attachedHandlers = array();
     $this->stage = 0;
     $this->bootime = microtime(true);
 }