You are here

public function StreamDecoratorTrait::__toString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php \GuzzleHttp\Psr7\StreamDecoratorTrait::__toString()

File

vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php, line 38

Class

StreamDecoratorTrait
Stream decorator trait @property StreamInterface stream

Namespace

GuzzleHttp\Psr7

Code

public function __toString() {
  try {
    if ($this
      ->isSeekable()) {
      $this
        ->seek(0);
    }
    return $this
      ->getContents();
  } catch (\Exception $e) {

    // Really, PHP? https://bugs.php.net/bug.php?id=53648
    trigger_error('StreamDecorator::__toString exception: ' . (string) $e, E_USER_ERROR);
    return '';
  }
}