Skip to content

Instantly share code, notes, and snippets.

@simensen
Created August 4, 2013 02:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save simensen/ba3fb9ff70d3d3a980b4 to your computer and use it in GitHub Desktop.
<?php
namespace Dflydev\Stack;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
class AuraFrameworkWrapper implements HttpKernelInterface
{
public function __construct($projectDirectory)
{
$this->projectDirectory = $projectDirectory;
}
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
if (!class_exists('Aura\Framework\Bootstrap\Factory')) {
require $this->projectDirectory . '/package/Aura.Framework/src/Aura/Framework/Bootstrap/Factory.php';
}
$auraRequest = $this->translateToAuraRequest($request);
$factory = new \Aura\Framework\Bootstrap\Factory;
$web = $factory->newInstance('web');
// we would need to do something with this step to enesure that
// we can pass in a precomposed Aura request instead of relying
// on globals.
//
// additionally, we would need a way to capture the response
// (Aura.Http Response?) instead of just assuming that exec
// will do everything including sending a response to the
// user agent.
//
// this may be as simple as calling something other than exec
// here, but i'll have to look into it more.
$auraResponse = $web->exec($auraRequest);
return $this->translateToSymfonyResponse($auraResponse);
}
public function translateToAuraRequest(Request $request)
{
// we need to do something to translate a Symfony Request
// to whatever Aura.Framework or Aura.Http needs...
}
public function translateToSymfonyResponse(AuraResponse $auraResponse)
{
// we need to do something to translate an Aura.Http response
// to a Symfony response...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment