Build the Server's Kernel.

@return \CupOfTea\TwoStream\Foundation\Ws\Kernel
969197
protected function buildKernel()
    {
        $this->app->singleton(
            Kernel::class,
            $this->getAppNamespace() . 'Ws\Kernel'
        );
        
        return $this->Kernel = $this->app->make(Kernel::class);
    }
1015270
private function _kernel()
    {
        if (CommonFunctions::executeProgram('uname', '-r', $strBuf, false)) {
            $result = $strBuf;
            if (CommonFunctions::executeProgram('uname', '-v', $strBuf, PSI_DEBUG)) {
                if (preg_match('/SMP/', $strBuf)) {
                    $result .= ' (SMP)';
                }
            }
            if (CommonFunctions::executeProgram('uname', '-m', $strBuf, PSI_DEBUG)) {
                $result .= ' '.$strBuf;
            }
            $this->sys->setKernel($result);
        } elseif (CommonFunctions::rfts('/proc/version', $strBuf, 1) && preg_match('/version\s+(\S+)/', $strBuf, $ar_buf)) {
            $result = $ar_buf[1];
            if (preg_match('/SMP/', $strBuf)) {
                $result .= ' (SMP)';
            }
            $this->sys->setKernel($result);
        }
    }
607286
public function getContainerBuilder() {
    if (!isset($this->containerBuilder)) {
      // Get the kernel, and hack it to get a compiled container.
      // We need this rather than the normal cached container, as that doesn't
      // allow us to get the full service definitions.
      $kernel = \Drupal::service('kernel');
      $kernel_R = new \ReflectionClass($kernel);

      $compileContainer_R = $kernel_R->getMethod('compileContainer');
      $compileContainer_R->setAccessible(TRUE);

      $this->containerBuilder = $compileContainer_R->invoke($kernel);
    }

    return $this->containerBuilder;
  }
660055
public function build()
    {
        if (!$this->factory) {
            $this->factory = $this->createDefaultFactory();
        }

        return $this->cache ? new CachedLoggerFactory($this->factory) : $this->factory;
    }
826167
public WebServerImpl build()
  {
    EnvLoader.init();

    _systemManager = createSystemManager();

    Thread thread = Thread.currentThread();
    ClassLoader oldLoader = thread.getContextClassLoader();

    boolean isValid = false;
    try {
      thread.setContextClassLoader(_systemManager.getClassLoader());

      Vfs.setPwd(getRootDirectory());

      /*
      if (! isEmbedded()) {
        logCopyright();
      }
      */
      logCopyright();

      preConfigureInit();

      configureRootDirectory();

      _serverSelf = initNetwork();
      Objects.requireNonNull(_serverSelf);

      addServices(); // _serverSelf);

      initHttpSystem(_systemManager, _serverSelf);

      WebServerImpl server = new WebServerImpl(this);
      /*
      build(systemManager,
            _serverSelf);
            */

      // init(server);

      isValid = true;

      _systemManager.start();

      return server;
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      throw ConfigException.wrap(e);
    } finally {
      thread.setContextClassLoader(oldLoader);

      if (! isValid) {
        _systemManager.shutdown(ShutdownModeAmp.IMMEDIATE);
      }
    }
  }
752916
protected function createContainerBuilder()
    {
        $builder = new ContainerBuilder();
        $this->kernel->boot();
        foreach ($this->kernel->getBundles() as $bundle) {
            // Register all extensions, otherwise there might be config parts that cannot be processed.
            $extension = $bundle->getContainerExtension();
            if ($extension !== null) {
                $builder->registerExtension($extension);
            }
        }
        // Load the application configuration, which might affect the loaded services.
        /* @var $locator FileLocatorInterface */
        $locator = $this->kernel->getContainer()->get('file_locator');
        $loaders = array(
            new XmlFileLoader($builder, $locator),
            new YamlFileLoader($builder, $locator),
            new IniFileLoader($builder, $locator),
            new PhpFileLoader($builder, $locator),
            (class_exists(DirectoryLoader::class) ? new DirectoryLoader($builder, $locator) : null),
            new ClosureLoader($builder),
        );
        $loaders = array_filter($loaders);
        $resolver = new LoaderResolver($loaders);
        $loader = new DelegatingLoader($resolver);
        $this->kernel->registerContainerConfiguration($loader);
        return $builder;
    }
1024907
public function build()
    {
        $this->readConfigs();

        $files = $this->getSiteFiles();

        $otherFiles = array_filter($files, function ($file) {
            return ! str_contains($file->getRelativePath(), '_blog');
        });

        if (@$this->configs['enableBlog']) {
            $blogPostsFiles = array_filter($files, function ($file) {
                return str_contains($file->getRelativePath(), '_blog');
            });

            $this->readBlogPostsData($blogPostsFiles);
        }

        $this->buildViewsData();

        $this->filesystem->cleanDirectory(KATANA_PUBLIC_DIR);

        if ($this->forceBuild) {
            $this->filesystem->cleanDirectory(KATANA_CACHE_DIR);
        }

        $this->handleSiteFiles($otherFiles);

        if (@$this->configs['enableBlog']) {
            $this->handleBlogPostsFiles($blogPostsFiles);
            $this->buildBlogPagination();
            $this->buildRSSFeed();
        }
    }
125282
public function getContainer(){
        if(null === $this->container){
            $factory    = (new ContainerFactory())
                ->append(\Fratily\Kernel\Container\KernelContainer::class)
            ;

            foreach($this->bundles as $bundle){
                if($bundle instanceof Bundle\ContainerRegisterInterface){
                    $bundle->containerRegister($factory);
                }
            }

            $this->container    = $factory->create([
                "kernel"    => $this,
            ]);
        }

        return $this->container;
    }
169098
public function build()
    {
        if (!empty($this->container)) {
            return $this->container;
        }

        $this->container = BuildUtil::removeNullElements([
            'type' => ContainerType::BUBBLE,
            'direction' => $this->direction,
            'header' => BuildUtil::build($this->headerComponentBuilder),
            'hero' => BuildUtil::build($this->heroComponentBuilder),
            'body' => BuildUtil::build($this->bodyComponentBuilder),
            'footer' => BuildUtil::build($this->footerComponentBuilder),
            'styles' => BuildUtil::build($this->stylesBuilder),
        ]);

        return $this->container;
    }
899107
private function buildSocket()
    {
        $socketDescriptor = sprintf(
            "%s://%s:%d",
            $this->scheme,
            $this->host,
            $this->port
        );

        $socket = @stream_socket_client(
            $socketDescriptor,
            $errNo,
            $errStr,
            $this->connectTimeout,
            \STREAM_CLIENT_CONNECT,
            stream_context_create($this->context)
        );

        if ($socket === false) {
            throw new RuntimeException(
                sprintf(
                    "Failed to create socket-client for %s: %s (%s)",
                    $socketDescriptor,
                    $errStr,
                    $errNo
                )
            );
        }

        // set non-blocking for UDP
        if (strcasecmp("udp", $this->scheme) == 0) {
            stream_set_blocking($socket, 0);
        }

        return $socket;
    }
804272
public function buildData()
    {
        $runtime = (microtime(true) - $this->kernel->getStartTime()) * 1000;

        $this->data = [
            'runtime' => $runtime
        ];
    }
7855
public function build()
    {
        $pm = new PluginManager($this->eventDispatcher);
        $pluginCollection = $pm->getPluginCollection();

        if (file_exists($this->path) === false) {
            return $pm;
        }

        $classnamesFromComposerFile = [];

        $finder = $this->buildFinder();

        foreach ($finder as $file) {
            if ($file->getFilename() === $this->composerFilename) {
                $classes = $this->getClassnamesFromComposerFile($file);
                $classnamesFromComposerFile = array_merge($classnamesFromComposerFile, $classes);

                continue;
            }

            $classname = $this->getClassnameFromPHPFilename($file);

            include_once $file->getRealPath();

            if ($this->hasImplementedPluginInterface($classname) === false) {
                continue;
            }

            $this->addPluginToCollection($classname, $pluginCollection);
        }

        foreach ($classnamesFromComposerFile as $classname) {
            if ($this->hasImplementedPluginInterface($classname) === true) {
                $this->addPluginToCollection($classname, $pluginCollection);
            }
        }

        return $pm;
    }
219596
public function build()
    {
        $file = rtrim($this->cacheDir, '/').'/'.$this->getFilename();
        $mapFile = $file.'.map';

        $cache = new PuliResourceCollectionCache($file, $this->isDebug());

        $resources = $this->resourceFinder->findByType($this->getType());

        if (!$cache->isFresh($resources)) {
            $resolvedResources = $this->resourceResolver->resolve($resources);
            $mappedContent = $this->contentBuilder->build(
                $this->getFilename(),
                $resolvedResources,
                array($this, 'sanitizePath'),
                array($this, 'prefixContent')
            );

            $cache->write($mappedContent->getContent());
            file_put_contents($mapFile, $mappedContent->getMap());

            if (!$this->debug) {
                $this->compressor->compressFile($file);
            }
        }

        return new MappedAsset($file, $mapFile);
    }
1304959
protected function buildContainer()
    {
        $container = $this->getContainerBuilder();
        $container->addObjectResource($this);
        $this->prepareContainer($container);
        if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) {
            $container->merge($cont);
        }
        return $container;
    }
48047
public function build()
    {
        $stream = new Stream('php://temp', 'wb+');


        $stream->write(json_encode(new MessageDecorator($this->getMessage())));

        return $this->getHttpMessage()
            ->withAddedHeader('Content-Type', 'application/json')
            ->withBody($stream);
    }
1068369
protected function createContainerBuilder()
	{
		$builder = new ContainerBuilder();
		
		foreach($this->getContainerParams() as $k => $v)
		{
			$builder->setParameter($k, $v);
		}
		
		return $builder;
	}
1306432
private function _kernel()
    {
        if (CommonFunctions::executeProgram('uname', '-s', $os, PSI_DEBUG) && ($os!="")) {
            if (CommonFunctions::executeProgram('uname', '-r', $version, PSI_DEBUG) && ($version!="")) {
                $os.=' '.$version;
            }
            if (CommonFunctions::executeProgram('uname', '-v', $subversion, PSI_DEBUG) && ($subversion!="")) {
                $os.=' ('.$subversion.')';
            }
            if (CommonFunctions::executeProgram('uname', '-i', $platform, PSI_DEBUG) && ($platform!="")) {
                $os.=' '.$platform;
            }
            $this->sys->setKernel($os);
        }
    }