/** * Handle incoming HTTP request using K2. * * Will display alittl info page when no Komponent has been found. */ public function handleHttpRequest() { $this->system->launch(); $request = $this->system->getTestkernel()->getEnvironment()->buildHttpRequest(); // Display index page when no path info is given. if ($request->getPathInfo() === '') { header('Content-Type: text/html; charset="utf-8"'); $settings = $this->settings; $settings['directory'] = str_replace('\\', '/', $settings['directory']); $settings['root'] = str_replace('\\', '/', $this->system->getTestKernel()->getDirectory()); $composerFile = $this->system->getSystemDirectory() . DIRECTORY_SEPARATOR . 'composer.json'; $params = ['system' => $this->system, 'ref' => new \ReflectionClass(get_class($this->system)), 'settings' => $settings, 'composerFile' => $composerFile, 'composerConfig' => json_decode(file_get_contents($composerFile), true), 'config' => $this->system->getSystemConfig()]; call_user_func(function (array $__) { extract($__, EXTR_SKIP); require ResourceStreamWrapper::resolve('k2://koolkode/k2/index.phtml'); }, $params); exit; } $this->system->getTestkernel()->handleWeb($request, true); }
protected function resolveResourcePath($resource) { return ResourceStreamWrapper::resolve($resource); }