public function build()
    {
        if ($this->isCacheEnabled()) {
            $file = $this->getCachePath().self::CACHE_FILENAME;
            if (file_exists($file)) {
                include_once $file;
                $this->serviceContainer = new \ProjectServiceContainer();

                return new Client($this->serviceContainer);
            }
        }
        $extension = new NeoClientExtension();
        $this->serviceContainer->registerExtension($extension);
        $this->serviceContainer->addCompilerPass(new AliasesCompilerPass());
        $this->serviceContainer->addCompilerPass(new ConnectionRegistryCompilerPass());
        $this->serviceContainer->addCompilerPass(new NeoClientExtensionsCompilerPass());
        $this->serviceContainer->addCompilerPass(new EventSubscribersCompilerPass());
        $this->serviceContainer->loadFromExtension($extension->getAlias(), $this->getConfiguration());
        $this->serviceContainer->compile();
        if ($this->serviceContainer->hasParameter('loggers')) {
            foreach ($this->serviceContainer->getParameter('loggers') as $channel => $logger) {
                switch ($logger['type']) {
                    case 'stream':
                        $this->createDefaultStreamLogger($channel, $logger['path'], $logger['level']);
                }
            }
        }

        foreach ($this->listeners as $event => $callback) {
            $this->serviceContainer->get('event_dispatcher')->addListener($event, $callback);
        }

        foreach ($this->loggers as $alias => $logger) {
            $this->serviceContainer->get('logger')->setLogger($alias, $logger);
        }

        if ($this->isCacheEnabled()) {
            $dumper = new PhpDumper($this->serviceContainer);
            file_put_contents($file, $dumper->dump());
        }

        if (!$this->skipHaFailureFileCheck) {
            $this->checkForHaConfig();
        }

        $client = $this->getClient();

        return $client;
    }
public function build()
    {
        if ($this->isCacheEnabled()) {
            $file = $this->getCachePath().self::CACHE_FILENAME;
            if (file_exists($file)) {
                include_once $file;
                $this->serviceContainer = new \ProjectServiceContainer();

                return new Client($this->serviceContainer);
            }
        }
        $extension = new NeoClientExtension();
        $this->serviceContainer->registerExtension($extension);
        $this->serviceContainer->addCompilerPass(new AliasesCompilerPass());
        $this->serviceContainer->addCompilerPass(new ConnectionRegistryCompilerPass());
        $this->serviceContainer->addCompilerPass(new NeoClientExtensionsCompilerPass());
        $this->serviceContainer->addCompilerPass(new EventSubscribersCompilerPass());
        $this->serviceContainer->loadFromExtension($extension->getAlias(), $this->getConfiguration());
        $this->serviceContainer->compile();
        if ($this->serviceContainer->hasParameter('loggers')) {
            foreach ($this->serviceContainer->getParameter('loggers') as $channel => $logger) {
                switch ($logger['type']) {
                    case 'stream':
                        $this->createDefaultStreamLogger($channel, $logger['path'], $logger['level']);
                }
            }
        }

        foreach ($this->listeners as $event => $callback) {
            $this->serviceContainer->get('event_dispatcher')->addListener($event, $callback);
        }

        foreach ($this->loggers as $alias => $logger) {
            $this->serviceContainer->get('logger')->setLogger($alias, $logger);
        }

        if ($this->isCacheEnabled()) {
            $dumper = new PhpDumper($this->serviceContainer);
            file_put_contents($file, $dumper->dump());
        }

        if (!$this->skipHaFailureFileCheck) {
            $this->checkForHaConfig();
        }

        $client = $this->getClient();

        return $client;
    }
public function build ( ) { if ( $ this -> isCacheEnabled ( ) ) { $ file = $ this -> getCachePath ( ) . self :: CACHE_FILENAME ; if ( file_exists ( $ file ) ) { include_once $ file ; $ this -> serviceContainer = new \ ProjectServiceContainer ( ) ; return new Client ( $ this -> serviceContainer ) ; } } $ extension = new NeoClientExtension ( ) ; $ this -> serviceContainer -> registerExtension ( $ extension ) ; $ this -> serviceContainer -> addCompilerPass ( new AliasesCompilerPass ( ) ) ; $ this -> serviceContainer -> addCompilerPass ( new ConnectionRegistryCompilerPass ( ) ) ; $ this -> serviceContainer -> addCompilerPass ( new NeoClientExtensionsCompilerPass ( ) ) ; $ this -> serviceContainer -> addCompilerPass ( new EventSubscribersCompilerPass ( ) ) ; $ this -> serviceContainer -> loadFromExtension ( $ extension -> getAlias ( ) , $ this -> getConfiguration ( ) ) ; $ this -> serviceContainer -> compile ( ) ; if ( $ this -> serviceContainer -> hasParameter ( 'loggers' ) ) { foreach ( $ this -> serviceContainer -> getParameter ( 'loggers' ) as $ channel => $ logger ) { switch ( $ logger [ 'type' ] ) { case 'stream' : $ this -> createDefaultStreamLogger ( $ channel , $ logger [ 'path' ] , $ logger [ 'level' ] ) ; } } } foreach ( $ this -> listeners as $ event => $ callback ) { $ this -> serviceContainer -> get ( 'event_dispatcher' ) -> addListener ( $ event , $ callback ) ; } foreach ( $ this -> loggers as $ alias => $ logger ) { $ this -> serviceContainer -> get ( 'logger' ) -> setLogger ( $ alias , $ logger ) ; } if ( $ this -> isCacheEnabled ( ) ) { $ dumper = new PhpDumper ( $ this -> serviceContainer ) ; file_put_contents ( $ file , $ dumper -> dump ( ) ) ; } if ( ! $ this -> skipHaFailureFileCheck ) { $ this -> checkForHaConfig ( ) ; } $ client = $ this -> getClient ( ) ; return $ client ; }
Builds the service definitions and processes the configuration.

@return \Neoxygen\NeoClient\Client
Builds the service definitions and processes the configuration .