Code Duplication    Length = 20-20 lines in 2 locations

src/Stream/Stream.php 1 location

@@ 207-226 (lines=20) @@
204
     * @override
205
     * @inheritDoc
206
     */
207
    public function close()
208
    {
209
        if ($this->closing)
210
        {
211
            return;
212
        }
213
214
        $this->closing = true;
215
        $this->readable = false;
216
        $this->writable = false;
217
218
        if ($this->buffer->isEmpty() === false)
219
        {
220
            $this->writeEnd();
221
        }
222
223
        $this->emit('close', [ $this ]);
224
        $this->handleClose();
225
        $this->emit('done', [ $this ]);
226
    }
227
228
    /**
229
     * Handle the outcoming stream.

src/Stream/StreamWriter.php 1 location

@@ 155-174 (lines=20) @@
152
     * @override
153
     * @inheritDoc
154
     */
155
    public function close()
156
    {
157
        if ($this->closing)
158
        {
159
            return;
160
        }
161
162
        $this->closing = true;
163
        $this->readable = false;
164
        $this->writable = false;
165
166
        if ($this->buffer->isEmpty() === false)
167
        {
168
            $this->writeEnd();
169
        }
170
171
        $this->emit('close', [ $this ]);
172
        $this->handleClose();
173
        $this->emit('done', [ $this ]);
174
    }
175
176
    /**
177
     * Handle the outcoming stream.