Create a HTTP component chain that adds our own routing configuration component
only for this request handler.

@return void
559387
protected function resolveDependencies()
    {
        $objectManager = $this->bootstrap->getObjectManager();
        $componentChainFactory = $objectManager->get(ComponentChainFactory::class);
        $configurationManager = $objectManager->get(ConfigurationManager::class);
        $this->settings = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow');
        $setupSettings = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Setup');
        $httpChainSettings = Arrays::arrayMergeRecursiveOverrule($this->settings['http']['chain'], $setupSettings['http']['chain']);
        $this->baseComponentChain = $componentChainFactory->create($httpChainSettings);
    }
226382
public function applicationConsole()
    {
        $this->setIsCli(true);
        $config = $this->getConfigArray();
        $config['defaultRoute'] = 'help';
        if (isset($config['components'])) {
            if (isset($config['components']['composition'])) {
                unset($config['components']['composition']);
            }
        }
        
        $this->includeYii();

        $baseUrl = null;
        if (isset($config['consoleBaseUrl'])) {
            $baseUrl = $config['consoleBaseUrl'];
        } elseif (isset($config['consoleHostInfo'])) {
            $baseUrl = '/';
        }
        
        $mergedConfig = ArrayHelper::merge($config, [
            'bootstrap' => ['luya\console\Bootstrap'],
            'components' => [
                'urlManager' => [
                    'class' => 'yii\web\UrlManager',
                    'enablePrettyUrl' => true,
                    'showScriptName' => false,
                    'baseUrl' => $baseUrl,
                    'hostInfo' => isset($config['consoleHostInfo']) ? $config['consoleHostInfo'] : null,
                ],
            ],
        ]);
        $this->app = new ConsoleApplication($mergedConfig);
        if (!$this->mockOnly) {
            exit($this->app->run());
        }
    }
955027
protected function constructHttpClient()
    {
        $hasHttpClient = (null !== $this->httpClient);

        $this->httpClient = new HttpClient($this->getOptions());

        if (!$hasHttpClient) {
            $this->httpClient->registerDefaults();
        }
    }
368176
public static function loadComponents()
    {
        $com = new Component();
        $file = new FileHandling();
        $diskScan = array_diff(scandir(route()->com), ['..', '.']);
        foreach ($diskScan as $scans) {
            $configFile = route()->com.$scans.'/component.json';
            if (file_exists($configFile)) {
                $c = $file->open($configFile, 'readOnly')->read();
                $file->close();
                $config = json_decode($c, true);
                if ($config['status'] === true) {
                    require_once route()->com.$scans.'/routes.php';
                }
            }
        }
        require_once 'dispatcher.php';
    }
851251
protected function prepareServiceAwareComponents()
    {
        /* @var Di\Service $service */
        foreach (static::$di->getServices() as $name => $service) {
            if (!$service->isShared()) {
                continue;
            }
            $component = static::$di->getShared($name);
            if ($component instanceof ServiceAwareInterface) {
                $this->serviceAwareComponents[$name] = $component;
            }
        }
        // Listen for further components
        Events::attach('di:afterServiceResolve', Closure::bind(function (Event $event) {
            $data = $event->getData();
            $name = $data['name'];
            $component = $data['instance'];
            if ($component instanceof ServiceAwareInterface) {
                $this->serviceAwareComponents[$name] = $component;
            }
        }, $this));
    }
1031254
public function setupRoutes()
    {
        $routes = $this->config();

        if (PHP_SAPI == 'cli') {
            $scripts = ( isset($routes['scripts']) ? $routes['scripts'] : [] );
            foreach ($scripts as $scriptIdent => $scriptConfig) {
                $this->setupScript($scriptIdent, $scriptConfig);
            }
        } else {
            $templates = ( isset($routes['templates']) ? $routes['templates'] : [] );
            foreach ($templates as $routeIdent => $templateConfig) {
                $this->setupTemplate($routeIdent, $templateConfig);
            }

            $actions = ( isset($routes['actions']) ? $routes['actions'] : [] );
            foreach ($actions as $actionIdent => $actionConfig) {
                $this->setupAction($actionIdent, $actionConfig);
            }
        }
    }
146025
public function loadConfiguration(): void
	{
		parent::loadConfiguration();

		$builder = $this->getContainerBuilder();

		$builder->addDefinition($this->prefix('application'))
			->setFactory(MiddlewareApplication::class)
			->setArguments([new Statement('@' . $this->prefix('chain') . '::create')]);
	}
1115508
public function configureApplication()
    {
        $config = file_get_contents($this->paths['app'].'/config/config.yml');
        $config = $this->parser->parse($config);

        $this->project_name     = $config['application']['project_name'];
        $this->routeCollection  = $this->bindRouteCollection($this->project_name);

        $this->addDbParams($config['database']['default'], $config['database']['types']);
        $this->createBaseEm($config['application']['environment']);
    }
405981
public function handleRequest()
    {
        // Create the request very early so the ResourceManagement has a chance to grab it:
        $request = Request::createFromEnvironment();
        $response = new Response();
        $this->componentContext = new ComponentContext($request, $response);

        $this->boot();
        $this->resolveDependencies();
        $response = $this->addPoweredByHeader($response);
        $this->componentContext->replaceHttpResponse($response);
        $baseUriSetting = $this->bootstrap->getObjectManager()->get(ConfigurationManager::class)->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.http.baseUri');
        if (!empty($baseUriSetting)) {
            $baseUri = new Uri($baseUriSetting);
            $request = $request->withAttribute(Request::ATTRIBUTE_BASE_URI, $baseUri);
            $this->componentContext->replaceHttpRequest($request);
        }

        $this->baseComponentChain->handle($this->componentContext);
        $response = $this->baseComponentChain->getResponse();

        $response->send();

        $this->bootstrap->shutdown(Bootstrap::RUNLEVEL_RUNTIME);
        $this->exit->__invoke();
    }
511285
private function setUp(): self
    {
        fn::allowCors();
        fn::allowHeader();
        $this->configApp();
        $this->configRoutes();

        return $this;
    }
784102
public function setup()
    {
        $this->groupRoutes();

        foreach ($this->routes as $type => $routes) {
            foreach ($routes as $name => $route) {
                $newRoute = new Route($name, $route);
                if (!$newRoute->hasParam('hostname')) {
                    $newRoute->setParam('hostname', $this->resolveDefaultHostName());
                }

                $routeType = $this->resolveRouteType($type);
                $routeType->add($this->getRouter(), $newRoute);
            }
        }
    }
1144281
public function loadConfiguration(): void
	{
		$builder = $this->getContainerBuilder();
		$config = $this->validateConfig($this->defaults);

		Validators::assertField($config, 'middlewares', 'array');

		// Register middleware chain builder
		$chain = $builder->addDefinition($this->prefix('chain'))
			->setAutowired(false);

		if ($config['debug'] !== true) {
			$chain->setFactory(ChainBuilder::class);
		} else {
			$chain->setFactory(DebugChainBuilder::class);

			$builder->addDefinition($this->prefix('middlewaresPanel'))
				->setFactory(MiddlewaresPanel::class, [$chain]);
		}
	}
832370
private function prepare()
    {
        $this->uri = $this->getURI();
        $this->discoverRoute();
        $this->isURIClean();
        $this->currentURL = $this->baseURL($this->uri);
        $this->baseURL = $this->baseURL();
    }
371079
public function map() : void
    {
        $this->router->pattern('id', '\d+');
        $this->router->pattern('hash', '[a-z0-9]+');
        $this->router->pattern('uuid', '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}');
        $this->router->pattern('slug', '[a-z0-9-]+');
        $this->router->pattern('token', '[a-zA-Z0-9]{60}');

        // Allow full domain routing by including dots in the domain regex pattern. Same
        // use-case as subdomains, only this enables you to handle i.e. www.site1.com
        // and www.site2.com within the same Laravel application with a single route or
        // route group.
        $this->router->pattern('domain', '[a-z0-9.]+');
    }
806492
public function handleRequest()
    {
        // Create the request very early so the Resource Management has a chance to grab it:
        $this->request = Request::createFromEnvironment();
        $this->response = new Response();

        $this->checkBasicRequirementsAndDisplayLoadingScreen();

        $this->boot();
        $this->resolveDependencies();
        if (isset($this->settings['http']['baseUri'])) {
            $this->request->setBaseUri(new Uri($this->settings['http']['baseUri']));
        }

        $componentContext = new ComponentContext($this->request, $this->response);
        $this->baseComponentChain->handle($componentContext);

        $this->baseComponentChain->getResponse()->send();

        $this->bootstrap->shutdown('Runtime');
        $this->exit->__invoke();
    }
642924
protected function createSubServer()
    {
        $config = $this->getServerInitConfig();
        $this->swooleServer = ServerManage::getServer('main')->getSwooleServer();
        $this->swoolePort = $this->swooleServer->addListener($config['host'], $config['port'], $config['sockType']);
    }
558600
private function generateConfiguration()
    {
        if (!in_array($this->format, array('yml', 'xml', 'php'))) {
            return;
        }

        $target = sprintf(
            '%s/Resources/config/routing/%s.%s',
            $this->bundle->getPath(),
            strtolower(str_replace('\\', '_', $this->document)),
            $this->format
        );

        $this->renderFile('config/routing.'.$this->format.'.twig', $target, array(
            'actions' => $this->actions,
            'route_prefix' => $this->routePrefix,
            'route_name_prefix' => $this->routeNamePrefix,
            'bundle' => $this->bundle->getName(),
            'document' => $this->document,
        ));
    }