Code Duplication    Length = 14-16 lines in 2 locations

lib/classes/Swift/Transport/StreamBuffer.php 2 locations

@@ 179-192 (lines=14) @@
176
     *
177
     * @return string
178
     */
179
    public function readLine($sequence)
180
    {
181
        if (isset($this->_out) && !feof($this->_out)) {
182
            $line = fgets($this->_out);
183
            if (!$line) {
184
                $metas = stream_get_meta_data($this->_out);
185
                if ($metas['timed_out']) {
186
                    throw new Swift_IoException('Connection to ' . $this->_getReadConnectionDescription() . ' Timed Out');
187
                }
188
            }
189
190
            return $line;
191
        }
192
    }
193
194
    /**
195
     * Reads $length bytes from the stream into a string and moves the pointer
@@ 207-222 (lines=16) @@
204
     *
205
     * @return string|null
206
     */
207
    public function read($length)
208
    {
209
        if (isset($this->_out) && !feof($this->_out)) {
210
            $ret = fread($this->_out, $length);
211
            if (!$ret) {
212
                $metas = stream_get_meta_data($this->_out);
213
                if ($metas['timed_out']) {
214
                    throw new Swift_IoException(
215
                        'Connection to ' . $this->_getReadConnectionDescription() . ' Timed Out'
216
                    );
217
                }
218
            }
219
220
            return $ret;
221
        }
222
    }
223
224
    /** Not implemented */
225
    public function setReadPointer($byteOffset)