1: <?php
2:
3: namespace PHPFastCGI\FastCGIDaemon;
4:
5: use PHPFastCGI\FastCGIDaemon\Http\RequestInterface;
6:
7: 8: 9: 10:
11: class CallbackWrapper implements KernelInterface
12: {
13: 14: 15:
16: private $callback;
17:
18: 19: 20: 21: 22: 23: 24:
25: public function __construct($handler)
26: {
27: if (!is_callable($handler)) {
28: throw new \InvalidArgumentException('Handler callback is not callable');
29: }
30:
31: $this->callback = $handler;
32: }
33:
34: 35: 36:
37: public function handleRequest(RequestInterface $request)
38: {
39: return call_user_func($this->callback, $request);
40: }
41: }
42: