Overview

Namespaces

  • PHPFastCGI
    • FastCGIDaemon
      • Command
      • Connection
      • ConnectionHandler
      • Exception
      • Http

Classes

  • PHPFastCGI\FastCGIDaemon\ApplicationFactory
  • PHPFastCGI\FastCGIDaemon\CallbackWrapper
  • PHPFastCGI\FastCGIDaemon\Command\DaemonRunCommand
  • PHPFastCGI\FastCGIDaemon\Connection\StreamSocketConnection
  • PHPFastCGI\FastCGIDaemon\Connection\StreamSocketConnectionPool
  • PHPFastCGI\FastCGIDaemon\ConnectionHandler\ConnectionHandler
  • PHPFastCGI\FastCGIDaemon\ConnectionHandler\ConnectionHandlerFactory
  • PHPFastCGI\FastCGIDaemon\Daemon
  • PHPFastCGI\FastCGIDaemon\DaemonFactory
  • PHPFastCGI\FastCGIDaemon\Http\Request

Interfaces

  • PHPFastCGI\FastCGIDaemon\ApplicationFactoryInterface
  • PHPFastCGI\FastCGIDaemon\Connection\ConnectionInterface
  • PHPFastCGI\FastCGIDaemon\Connection\ConnectionPoolInterface
  • PHPFastCGI\FastCGIDaemon\ConnectionHandler\ConnectionHandlerFactoryInterface
  • PHPFastCGI\FastCGIDaemon\ConnectionHandler\ConnectionHandlerInterface
  • PHPFastCGI\FastCGIDaemon\DaemonFactoryInterface
  • PHPFastCGI\FastCGIDaemon\DaemonInterface
  • PHPFastCGI\FastCGIDaemon\Http\RequestInterface
  • PHPFastCGI\FastCGIDaemon\KernelInterface

Exceptions

  • PHPFastCGI\FastCGIDaemon\Exception\ConnectionException
  • PHPFastCGI\FastCGIDaemon\Exception\DaemonException
  • PHPFastCGI\FastCGIDaemon\Exception\ProtocolException
  • PHPFastCGI\FastCGIDaemon\Exception\ShutdownException
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace PHPFastCGI\FastCGIDaemon;
 4: 
 5: use PHPFastCGI\FastCGIDaemon\Http\RequestInterface;
 6: 
 7: /**
 8:  * Wraps a callback (such as a closure, function or class and method pair) as an
 9:  * implementation of the kernel interface.
10:  */
11: class CallbackWrapper implements KernelInterface
12: {
13:     /**
14:      * @var callable
15:      */
16:     private $callback;
17: 
18:     /**
19:      * Constructor.
20:      *
21:      * @param callable $handler The handler callback to wrap
22:      *
23:      * @throws \InvalidArgumentException When not given callable callback
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:      * {@inheritdoc}
36:      */
37:     public function handleRequest(RequestInterface $request)
38:     {
39:         return call_user_func($this->callback, $request);
40:     }
41: }
42: 
API documentation generated by ApiGen