PPI\Framework\App::boot PHP Méthode

boot() public méthode

This method is automatically called by dispatch(), but you can use it to build all services when not handling a request.
public boot ( )
    public function boot()
    {
        if (true === $this->booted) {
            return $this;
        }
        if ($this->isDebug()) {
            ExceptionHandler::register(true, 'UTF-8', 'PPI Framework', self::VERSION, true);
        }
        $this->serviceManager = $this->buildServiceManager();
        $this->log('debug', sprintf('Booting %s ...', $this->name));
        // Loading our Modules
        $this->getModuleManager()->loadModules();
        if ($this->debug) {
            $modules = $this->getModuleManager()->getModules();
            $this->log('debug', sprintf('All modules online (%d): "%s"', count($modules), implode('", "', $modules)));
        }
        // Lets get all the services our of our modules and start setting them in the ServiceManager
        $moduleServices = $this->serviceManager->get('ModuleDefaultListener')->getServices();
        foreach ($moduleServices as $key => $service) {
            $this->serviceManager->setFactory($key, $service);
        }
        $this->booted = true;
        if ($this->debug) {
            $this->log('debug', sprintf('%s has booted (in %.3f secs)', $this->name, microtime(true) - $this->startTime));
        }
        return $this;
    }

Usage Example

Exemple #1
0
 public function boot()
 {
     parent::boot();
     return $this;
 }