public function register(ApplicationInterface $application) { if ($application instanceof MainApplicationInterface) { if ($this->mainApplication) { throw new \RuntimeException('You cannot have two main applications.'); } else { $this->mainApplication = $application; } } $this->applications[$application->getName()] = $application; $application->buildContainer(); $this->dispatcher->dispatch('application.registered', new ApplicationEvent($application)); }
public function register(ApplicationInterface $application) { $application->setContainer($this->container); $this->container->get('application_repository')->register($application); }