Hey,
I'm currently in the process of implementing something similar myself, and after creating a convertor method to try to do this and going down a long-winded path, their is a better way. Import Guzzle PSR7 into your project and you can instantiate a request object with a convenience method as shown:
use GuzzleHttp\Psr7\ServerRequest;
//in your controller action method
$response = new PhalconResponsePSR7(); // I'm still working on this part
try {
// Try to respond to the access token request
$serverRequest = ServerRequest::fromGlobals(); // instantiates a Guzzle serverRequest from the global request vars
echo $server->respondToAccessTokenRequest($serverRequest, $response);
} catch (OAuthServerException $exception) {
// All instances of OAuthServerException can be converted to a PSR-7 response
$this->view->disable();
//Create a response instance
$presponse = new \Phalcon\Http\Response();
//Set the content of the response
$presponse->setContent($exception->generateHttpResponse($response)->getBody());
//Return the response
return $presponse;
} catch (\Exception $exception) {
// Catch unexpected exceptions
$body = $response->getBody();
$body->write($exception->getMessage());
echo $body;
}
This is very basic and I'm still working on the response (though that's slightly more simple I believe) but it should get you started