Skip to content

Commit bb319e1

Browse files
Create ApplicationWrapper.php
1 parent 8fd6983 commit bb319e1

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

src/ApplicationWrapper.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace PHPFastCGI\Adapter\Expressive;
4+
5+
use PHPFastCGI\FastCGIDaemon\Http\RequestInterface;
6+
use PHPFastCGI\FastCGIDaemon\KernelInterface;
7+
use Zend\Diactoros\Response;
8+
use Zend\Expressive\Application;
9+
10+
/**
11+
* Wraps a Zend Expressive application object as an implementation of the kernel
12+
* interface.
13+
*/
14+
class ApplicationWrapper implements KernelInterface
15+
{
16+
/**
17+
* @var Application
18+
*/
19+
private $application;
20+
21+
/**
22+
* Constructor.
23+
*
24+
* @param Application $application The Zend Expressive application object to wrap
25+
*/
26+
public function __construct(Application $application)
27+
{
28+
$this->application = $application;
29+
}
30+
31+
/**
32+
* {@inheritdoc}
33+
*/
34+
public function handleRequest(RequestInterface $request)
35+
{
36+
return call_user_func($this->application, $request->getServerRequest(), new Response());
37+
}
38+
}

0 commit comments

Comments
 (0)