comparison vendor/guzzlehttp/psr7/src/AppendStream.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
14 private $streams = []; 14 private $streams = [];
15 15
16 private $seekable = true; 16 private $seekable = true;
17 private $current = 0; 17 private $current = 0;
18 private $pos = 0; 18 private $pos = 0;
19 private $detached = false;
20 19
21 /** 20 /**
22 * @param StreamInterface[] $streams Streams to decorate. Each stream must 21 * @param StreamInterface[] $streams Streams to decorate. Each stream must
23 * be readable. 22 * be readable.
24 */ 23 */
71 * {@inheritdoc} 70 * {@inheritdoc}
72 */ 71 */
73 public function close() 72 public function close()
74 { 73 {
75 $this->pos = $this->current = 0; 74 $this->pos = $this->current = 0;
75 $this->seekable = true;
76 76
77 foreach ($this->streams as $stream) { 77 foreach ($this->streams as $stream) {
78 $stream->close(); 78 $stream->close();
79 } 79 }
80 80
81 $this->streams = []; 81 $this->streams = [];
82 } 82 }
83 83
84 /** 84 /**
85 * Detaches each attached stream 85 * Detaches each attached stream.
86 *
87 * Returns null as it's not clear which underlying stream resource to return.
86 * 88 *
87 * {@inheritdoc} 89 * {@inheritdoc}
88 */ 90 */
89 public function detach() 91 public function detach()
90 { 92 {
91 $this->close(); 93 $this->pos = $this->current = 0;
92 $this->detached = true; 94 $this->seekable = true;
95
96 foreach ($this->streams as $stream) {
97 $stream->detach();
98 }
99
100 $this->streams = [];
93 } 101 }
94 102
95 public function tell() 103 public function tell()
96 { 104 {
97 return $this->pos; 105 return $this->pos;