Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function __toString()
 {
     try {
         return Util::copyToString($this);
     } catch (Exception $e) {
         return '';
     }
 }
Beispiel #2
0
 public function testCopiesToStringStopsWhenReadFails()
 {
     $body = 'foobaz';
     $stream = fopen('php://temp', 'r+');
     fwrite($stream, $body);
     fseek($stream, 0);
     $s1 = new Stream($stream);
     $s1 = FnStream::decorate($s1, ['read' => function () {
         return '';
     }]);
     $result = Util::copyToString($s1);
     $this->assertEquals('', $result);
 }
 /**
  * {@inheritdoc}
  */
 public function getContents()
 {
     return Util::copyToString($this);
 }