Set response body

@param mixed $body Response body
@return void
@throws InvalidResponseException
433504
public function setBody($body)
    {
        if ($body !== false && (empty($body) || !is_array($body) || (count($body) % 2) !== 0)) {
            throw new InvalidResponseException($this->command, $body);
        }
        parent::setBody($body);
    }
846211
public function setTextBody($text) {
    if (!is_string($text)) {
      $error = sprintf("Plain text given is not a string (Actual type: %s).",
                       gettype($text));
      throw new \InvalidArgumentException($error);
    }
    $this->message->setTextbody($text);
  }
864588
public function initialize($body)
    {
        $request = $this->paystackHttpClient->post(
            Resource::INITIALIZE_TRANSACTION,
            [
                'body'  => is_array($body) ? $this->toJson($body) : $body,
            ]
        );

        return $this->processResourceRequestResponse($request);
    }
105271
public function setBody($body = '')
    {
        $this->body = $body;
        $this->debug->debug(__FUNCTION__, 'setBody: ', $this->body);
    }
585036
protected function setBody(StreamInterface $body)
    {
        if ($body instanceof OutputBufferStream && $this->isStale() === false) {
            $body->useGlobally();
        }
        
        $this->body = $body;
    }
254127
public function setBody($body) {
        if (is_string($body) || is_null($body)) {
            $this->rawBody = $this->body = $body;
        } elseif (is_array($body) || is_bool($body) || is_numeric($body) || $body instanceof \JsonSerializable) {
            $this->rawBody = json_encode($body, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
            $this->body = $body;
        } else {
            $this->rawBody = '';
            $this->body = $body;
        }

        return $this;
    }
907374
private function setResponse($response)
	{
		$xml = new \SimpleXMLElement('<BaseResponse />');
		try
		{
			$xml = new \SimpleXMLElement($response);
		}
		catch(\Exception $ex){}
		$xml->registerXPathNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance');
		$this->response = $xml;
	}
1211046
public static function create($body)
    {
        if (0 !== strpos($body, static::START_TOKEN)) {
            throw new InvalidArgumentException("Unexpected response body.");
        }
        if (static::END_TOKEN !== substr($body, -strlen(static::END_TOKEN))) {
            throw new InvalidArgumentException("Unexpected response body.");
        }

        $body = substr($body, strlen(static::START_TOKEN), -strlen(static::END_TOKEN));

        $parts = explode('|', trim($body, '|'));
        if (empty($parts)) {
            throw new InvalidArgumentException("Unexpected response body.");
        }

        $response = new static();

        for ($i = 0; $i < count($parts); $i++) {
            list($key, $value) = explode(':', $parts[$i], 2);

            if ($key === Config::RESULT) {
                if (0 < strpos($value, ':')) {
                    list($code, $field) = explode(':', $value, 2);
                } else {
                    $code = $value;
                    $field = 'unknown';
                }
                $response->set(Config::RESULT, $code);
                $response->set(Config::FIELD, $field);
            } else {
                $response->set($key, $value);
            }
        }

        return $response;
    }
1289494
public function setBody($body)
    {
        if (!$this->checkFixedArray($body, 3, true)) {
            throw new InvalidResponseException($this->command, $body);
        }
        foreach (array_slice($body, 2) as $node) {
            if (!$this->checkFixedArray($node, 4)) {
                throw new InvalidResponseException($this->command, $body);
            }
        }
        parent::setBody($body);
    }
73283
protected function parseAccessTokenResponse($responseBody)
    {
        $request = \Request::getInstance();
        if ($request->get('error')) {
            $reason = $request->get('error_description');
            throw new TokenResponseException($reason);
        }

        $data = json_decode($responseBody, true);

        if (null === $data || !is_array($data)) {
            throw new TokenResponseException('Unable to parse response.');
        } elseif (isset($data['error'])) {
            throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
        }

        $token = new StdOAuth2Token();
        $token->setAccessToken($data['access_token']);
        $token->setLifetime($data['expires_in']);

        if (isset($data['refresh_token'])) {
            $token->setRefreshToken($data['refresh_token']);
            unset($data['refresh_token']);
        }

        unset($data['access_token']);
        unset($data['expires_in']);

        $data['state'] = $request->get('state');

        $token->setExtraParams($data);

        return $token;
    }
471895
function _setResponseBody(body) {
    verifyRequestSent(this);
    verifyHeadersReceived(this);
    verifyResponseBodyType(body);

    var chunkSize = this.chunkSize || 10;
    var index = 0;
    this.responseText = "";

    do {
      if (this.async) {
        this._readyStateChange(FakeXMLHttpRequest.LOADING);
      }

      this.responseText += body.substring(index, index + chunkSize);
      index += chunkSize;
    } while (index < body.length);

    var type = this.getResponseHeader("Content-Type");

    if (this.responseText && (!type || /(text\/xml)|(application\/xml)|(\+xml)/.test(type))) {
      try {
        this.responseXML = parseXML(this.responseText);
      } catch (e) {
        // Unable to parse XML - no biggie
      }
    }

    if (this.async) {
      this._readyStateChange(FakeXMLHttpRequest.DONE);
    } else {
      this.readyState = FakeXMLHttpRequest.DONE;
    }
  }
14750
public function setBody($text)
    {
        if (is_string($text)) {
            $this->lines = explode("\n", $text);
        } elseif (is_array($text)) {
            $this->lines = $text;
        } else {
            throw new InvalidArgumentTypeException('Invalid body type', $text, array('string', 'array'));
        }
    }
1060034
public function setBody( $body )
	{
		if( !is_string( $body ) )
			throw new InvalidArgumentException( 'Body must be string' );
		$this->body		= trim( $body );
		$this->headers->setFieldPair( "Content-Length", strlen( $this->body ), TRUE );
	}
1359875
protected function handleBody($body)
    {
        if (is_string($body)) {
            $stream = new Stream('php://temp', 'wb+');
            $stream->write($body);
            $stream->rewind();

            $body = $stream;
        }

        if (!$body instanceof StreamInterface) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Invalid body content type %s, please provide string or StreamInterface',
                    gettype($body)
                )
            );
        }

        return $body;
    }
439684
public function setResponse($response)
    {
        $xml = simplexml_load_string($response);
        if (!empty($xml->error)) {
            $this->message = (string) $xml->error;
        }
    }
132734
public function setBody(\GoetasWebservices\SoapServices\SoapClient\Envelope\SoapEnvelope12\Messages\FaultBody $body)
    {
        $this->body = $body;
        return $this;
    }
202946
public function setBody($body, $contentType = null)
    {
        if ($body !== $this->body) {
            $this->clearCache();
        }

        $this->body = $body;
        if (null !== $contentType) {
            $this->setContentType($contentType);
        }

        return $this;
    }