Example #1
0
 /**
  * Execute the server.
  *
  * @param   callable $errorHandler The error handler callback.
  */
 public function listen($errorHandler = null)
 {
     if (version_compare(PHP_VERSION, '5.4', '>=') && $this->handler instanceof \Closure) {
         $this->handler = $this->handler->bindTo($this);
     }
     $response = call_user_func($this->handler, $this->request, $this->response, $errorHandler);
     if (!$response instanceof ResponseInterface) {
         $response = $this->response;
     }
     $this->output->respond($response);
 }