Code Duplication    Length = 19-19 lines in 2 locations

src/Stream/Stream.php 1 location

@@ 160-178 (lines=19) @@
157
     * @override
158
     * @inheritDoc
159
     */
160
    public function write($text = '')
161
    {
162
        if (!$this->writable)
163
        {
164
            return $this->throwAndEmitException(
165
                new WriteException('Stream is no longer writable.')
166
            );
167
        }
168
169
        $this->buffer->push($text);
170
171
        if (!$this->writing && !$this->paused)
172
        {
173
            $this->writing = true;
174
            $this->loop->addWriteStream($this->resource, $this->getHandleWriteFunction());
175
        }
176
177
        return $this->buffer->length() < $this->bufferSize;
178
    }
179
180
    /**
181
     * @override

src/Stream/StreamWriter.php 1 location

@@ 131-149 (lines=19) @@
128
     * @override
129
     * @inheritDoc
130
     */
131
    public function write($text = '')
132
    {
133
        if (!$this->writable)
134
        {
135
            return $this->throwAndEmitException(
136
                new WriteException('Stream is no longer writable.')
137
            );
138
        }
139
140
        $this->buffer->push($text);
141
142
        if (!$this->writing && !$this->paused)
143
        {
144
            $this->writing = true;
145
            $this->loop->addWriteStream($this->resource, $this->getHandleWriteFunction());
146
        }
147
148
        return $this->buffer->length() < $this->bufferSize;
149
    }
150
151
    /**
152
     * @override