setEmitter() public method

Set alternate response emitter to use.
public setEmitter ( Zend\Diactoros\Response\EmitterInterface $emitter )
$emitter Zend\Diactoros\Response\EmitterInterface
コード例 #1
0
ファイル: Application.php プロジェクト: anctemarry27/cogs
 /**
  * "Listen" to an incoming request
  *
  * 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.
  *
  * @param null|callable $finalHandler
  */
 private function traverse_middleware_pipeline($finalHandler = NULL)
 {
     $pipeline = $this->kernel->middleware();
     $emitter = new SapiEmitter();
     $this->server->setEmitter($emitter);
     ob_start();
     $bufferLevel = ob_get_level();
     # the work is done here
     $response = $pipeline($this->server->{'request'}, $this->server->{'response'}, $finalHandler);
     if (!$response instanceof ResponseInterface) {
         $response = $this->server->{'response'};
     }
     $emitter->emit($response, $bufferLevel);
 }