If none was registered during instantiation, this will lazy-load an
EmitterStack composing an SapiEmitter instance.
public getEmitter ( ) : Zend\Diactoros\Response\EmitterInterface | ||
Результат | Zend\Diactoros\Response\EmitterInterface |
private function initResponseCollector() { /** * @var Zend\Expressive\Emitter\EmitterStack */ $emitterStack = $this->application->getEmitter(); while (!$emitterStack->isEmpty()) { $emitterStack->pop(); } $this->responseCollector = new ZendExpressiveConnector\ResponseCollector(); $emitterStack->unshift($this->responseCollector); }
public function testAllowsInjectingEmitterAtInstantiation() { $emitter = $this->prophesize('Zend\\Diactoros\\Response\\EmitterInterface'); $app = new Application($this->router->reveal(), null, null, $emitter->reveal()); $test = $app->getEmitter(); $this->assertSame($emitter->reveal(), $test); }