Created
April 19, 2010 14:26
-
-
Save indeyets/371095 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The return statement should use the $headers variable, no?