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
     $this->dispatcher->flushHandlers();
     // flush all services
     $services = $this->container->getServiceIds();
     rsort($services);
     foreach ($services as $id) {
         if (!in_array($id, array('zikula', 'zikula.servicemanager', 'service_container', 'zikula.eventmanager', 'event_dispatcher'))) {
             $this->container->removeDefinition($id);
         }
     }
     // flush arguments.
     $this->container->getParameterBag()->clear();
     $this->attachedHandlers = array();
     $this->stage = 0;
     $this->bootime = microtime(true);
     $this->attachHandlers($this->handlerDir);
 }