Phly\Http\Server::listen PHP Method

listen() public method

If provided a $finalHandler, that callable will be used for incomplete requests. Output buffering is enabled prior to invoking the attached callback; any output buffered will be sent prior to any response body content.
public listen ( callable $finalHandler = null )
$finalHandler callable
    public function listen(callable $finalHandler = null)
    {
        $callback = $this->callback;
        ob_start();
        $bufferLevel = ob_get_level();
        $response = $callback($this->request, $this->response, $finalHandler);
        if (!$response instanceof ResponseInterface) {
            $response = $this->response;
        }
        $this->getEmitter()->emit($response, $bufferLevel);
    }