/** * Create a new Illuminate HTTP request from server variables. * * @return static */ public static function capture() { static::enableHttpMethodParameterOverride(); return static::createFromBase(SymfonyRequest::createFromGlobals()); }
/** * @param SymfonyRequest $request * @return Response */ protected function doRequest($request) { $_COOKIE = $request->getCookies(); $_SERVER = $request->getServer(); $_FILES = $request->getFiles(); $uri = str_replace('http://localhost', '', $request->getUri()); $_SERVER['KOHANA_ENV'] = 'testing'; $_SERVER['REQUEST_METHOD'] = strtoupper($request->getMethod()); $_SERVER['REQUEST_URI'] = strtoupper($uri); \Request::$initial = null; $kohanaRequest = \Request::factory($uri); $kohanaRequest->method($_SERVER['REQUEST_METHOD']); if (strtoupper($request->getMethod()) == 'GET') { $kohanaRequest->query($request->getParameters()); } else { if (strpos($request->getUri(), '?') !== false) { $parse = parse_url($request->getUri()); if ($parse['query']) { parse_str($parse['query'], $queryParams); if ($queryParams) { $kohanaRequest->query($queryParams); } } } } if (strtoupper($request->getMethod()) == 'POST' || strtoupper($request->getMethod()) == 'PUT') { if ($request->getContent()) { $kohanaRequest->headers('Content-Type', 'application/json'); $kohanaRequest->body($request->getContent()); } $kohanaRequest->post($request->getParameters()); } if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) { $kohanaRequest->headers('Authorization', 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $_SERVER['PHP_AUTH_PW'])); } $kohanaRequest->cookie($_COOKIE); $kohanaRequest::$initial = $kohanaRequest; $kohanaResponse = $kohanaRequest->execute(); $content = $kohanaResponse->body(); $headers = (array) $kohanaResponse->headers(); $status = $kohanaResponse->status(); $response = new Response($content, $status, $headers); return $response; }
Registry::set('application.request.method', $_SERVER['REQUEST_METHOD']); /** * Require the config files and add those results to the Registry */ Registry::set('config', require APP . 'config' . DS . 'config.php'); /** * Setting up the events manager */ Registry::set('foundation.events', new Events()); Events::create(array('title' => 'application.boot', 'event' => function () { })); /** * Setting the current HTTP request to the events manager */ Events::create(array('title' => 'request.get', 'event' => function () { return SymfonyRequest::createFromGlobals(); })); /** * Setting up the default error page */ Events::create(array('title' => 'application.error.404', 'event' => function () { return '<h2>Er is een fout opgetreden!</h2><p>De pagina waarop je gezocht op hebt, is helaas niet (meer) beschrikaar'; })); /** * Creating all aliases for the original classes, they are specified in the config array */ foreach (Registry::get('config')['classAliases'] as $originalClass => $alias) { AliasLoader::create($originalClass, $alias); } /** * Attach all of the service providers (specified the config file) to the application