Zend\Stratigility\Http\Response::write PHP Méthode

write() public méthode

Proxies to the underlying stream and writes the provided data to it.
public write ( string $data ) : self
$data string
Résultat self
    public function write($data)
    {
        trigger_error(sprintf('%s is now deprecated; use $response->getBody()->write(). ' . '%s will no longer be available starting in Stratigility 2.0.0. ' . 'Please see https://docs.zendframework.com/migration/to-v2/#deprecated-functionality ' . 'for full details.', __CLASS__, __METHOD__), E_USER_DEPRECATED);
        if ($this->complete) {
            throw $this->responseIsAlreadyCompleted(__METHOD__);
        }
        $this->getBody()->write($data);
        return $this;
    }

Usage Example

 /**
  * Write the given message to the response and mark it complete.
  *
  * If the message is an Http\Response decorator, call and return its
  * `end()` method; otherwise, decorate the response and `end()` it.
  *
  * @param ResponseInterface $response
  * @param string $message
  * @return Http\Response
  */
 private function completeResponse(ResponseInterface $response, $message)
 {
     if ($response instanceof Http\Response) {
         return $response->write($message);
     }
     $response = new Http\Response($response);
     return $response->write($message);
 }
All Usage Examples Of Zend\Stratigility\Http\Response::write