public function emit(EmitterInterface $emitter = null)
    {
        if ($this->isStale) {
            throw new \BadMethodCallException("Unable to emit a stale response object");
        }
        
        if (!isset($emitter)) {
            $emitter = $this->createEmitter();
        }
        
        if (isset($this->status) && !$this->status instanceof GlobalResponseStatus) {
            $emitter->emitStatus($this);
        }
        
        if (isset($this->headers) && !$this->headers instanceof GlobalResponseHeaders) {
            $emitter->emitHeaders($this);
        }
        
        if (isset($this->body) && $this->body->getMetadata('url') !== 'php://output') {
            $emitter->emitBody($this);
        }
    }