yii\httpclient\Message::toString PHP Method

toString() public method

Returns string representation of this HTTP message.
public toString ( ) : string
return string the string representation of this HTTP message.
    public function toString()
    {
        $result = '';
        if ($this->hasHeaders()) {
            $headers = $this->composeHeaderLines();
            $result .= implode("\n", $headers);
        }
        $content = $this->getContent();
        if ($content !== null) {
            $result .= "\n\n" . $content;
        }
        return $result;
    }

Usage Example

 /**
  * @inheritdoc
  */
 public function toString()
 {
     if (!$this->isPrepared) {
         $this->prepare();
     }
     $result = strtoupper($this->getMethod()) . ' ' . $this->getFullUrl();
     $parentResult = parent::toString();
     if ($parentResult !== '') {
         $result .= "\n" . $parentResult;
     }
     return $result;
 }
All Usage Examples Of yii\httpclient\Message::toString