Skip to content

Instantly share code, notes, and snippets.

@indeyets
Created April 19, 2010 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indeyets/371095 to your computer and use it in GitHub Desktop.
Save indeyets/371095 to your computer and use it in GitHub Desktop.
<?php
class Symfony2App
{
private $kernel;
public function __construct(\Symfony\Foundation\Kernel $kernel)
{
$this->kernel = $kernel;
}
public function __invoke($context)
{
$request = new \Symfony\Components\RequestHandler\Request(
$context['_GET'],
isset($context['_POST']) ? $context['_POST'] : null,
null,
$context['_COOKIES'],
isset($context['_FILES']) ? $context['_FILES'] : null,
$context['env']
);
$response = $this->kernel->handle($request);
$headers = array();
foreach ($response->getHeaders() as $k => $v) {
$headers[] = $k;
$headers[] = $v;
}
return array($response->getStatusCode(), $headers, $response->getContent());
}
}
@fabpot
Copy link

fabpot commented Apr 19, 2010

The return statement should use the $headers variable, no?

@indeyets
Copy link
Author

@fabpot fixed, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment