Code Duplication    Length = 15-15 lines in 4 locations

src/Stream/StreamSeeker.php 1 location

@@ 189-203 (lines=15) @@
186
     * @override
187
     * @inheritDoc
188
     */
189
    public function close()
190
    {
191
        if ($this->closing)
192
        {
193
            return;
194
        }
195
196
        $this->closing = true;
197
        $this->readable = false;
198
        $this->writable = false;
199
200
        $this->emit('close', [ $this ]);
201
        $this->handleClose();
202
        $this->emit('done', [ $this ]);
203
    }
204
205
    /**
206
     * Emit error event and the throws it too.

src/Stream/Sync/Stream.php 1 location

@@ 160-174 (lines=15) @@
157
     * @override
158
     * @inheritDoc
159
     */
160
    public function close()
161
    {
162
        if ($this->closing)
163
        {
164
            return;
165
        }
166
167
        $this->closing = true;
168
        $this->readable = false;
169
        $this->writable = false;
170
171
        $this->emit('close', [ $this ]);
172
        $this->handleClose();
173
        $this->emit('done', [ $this ]);
174
    }
175
}
176

src/Stream/Sync/StreamReader.php 1 location

@@ 115-129 (lines=15) @@
112
     * @override
113
     * @inheritDoc
114
     */
115
    public function close()
116
    {
117
        if ($this->closing)
118
        {
119
            return;
120
        }
121
122
        $this->closing = true;
123
        $this->readable = false;
124
        $this->writable = false;
125
126
        $this->emit('close', [ $this ]);
127
        $this->handleClose();
128
        $this->emit('done', [ $this ]);
129
    }
130
}
131

src/Stream/Sync/StreamWriter.php 1 location

@@ 104-118 (lines=15) @@
101
     * @override
102
     * @inheritDoc
103
     */
104
    public function close()
105
    {
106
        if ($this->closing)
107
        {
108
            return;
109
        }
110
111
        $this->closing = true;
112
        $this->readable = false;
113
        $this->writable = false;
114
115
        $this->emit('close', [ $this ]);
116
        $this->handleClose();
117
        $this->emit('done', [ $this ]);
118
    }
119
}
120