コード例 #1
0
ファイル: PumpStream.php プロジェクト: narrowspark/framework
 /**
  * {@inheritdoc}
  */
 public function __toString()
 {
     try {
         return Util::copyToString($this);
     } catch (Exception $e) {
         return '';
     }
 }
コード例 #2
0
ファイル: UtilTest.php プロジェクト: viserio/http
 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);
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function getContents()
 {
     return Util::copyToString($this);
 }